题目: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 解答: 遍历每个节点 直接交换他们的左右节点 代码: public static TreeNode invertTree(TreeNode ...
分类:
编程语言 时间:
2017-05-04 14:38:24
阅读次数:
150
题目:
Invert a binary tree.
4
/ 2 7
/ \ / 1 3 6 9
to
4
/ 7 2
/ \ / 9 6 3 1
解答:
遍历每一个节点 直接交换他们的左右节点
代码:
public static TreeNode invertTr...
分类:
编程语言 时间:
2015-07-06 17:57:58
阅读次数:
163