leetcodetreenode-leetcode-226-Invert-Binary-Tree:leetcode-226-Invert-二叉

时间:2024-07-21 03:04:27
【文件属性】:

文件名称:leetcodetreenode-leetcode-226-Invert-Binary-Tree:leetcode-226-Invert-二叉

文件大小:990B

文件格式:ZIP

更新时间:2024-07-21 03:04:27

系统开源

leetcode 树节点leetcode 226 - 反转二叉树 方法一:递归 C# public TreeNode InvertTree ( TreeNode root ) { if ( root == null ) return root ; var temp = root . left ; root . left = root . right ; root . right = temp ; root . left = InvertTree ( root . left ); root . right = InvertTree ( root . right ); return root ; } Java public TreeNode InvertTree( TreeNode root) { if (root == null ) return root; TreeNode temp = root . left; root . left = root . right; root . right = temp; root . left = InvertTree(root .


【文件预览】:
leetcode-226-Invert-Binary-Tree-master
----README.md(2KB)

网友评论