2022-01-02(剑指 Offer 27. 二叉树的镜像)

/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public TreeNode mirrorTree(TreeNode root) {
if(root==null){
return null;
}
TreeNode temp=mirrorTree(root.left);
root.left=mirrorTree(root.right);
root.right=temp;

2022-01-02(剑指 Offer 27. 二叉树的镜像)最先出现在Python成神之路

版权声明:
作者:ht
链接:https://www.techfm.club/p/12532.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>