
Breath First Search
Arcome
这个作者很懒,什么都没留下…
展开
-
LeetCode #226 - Invert Binary Tree - Easy
ProblemInvert a binary tree.Example 4 / \ 2 7 / \ / \1 3 6 9-> 4 / \ 7 2 / \ / \9 6 3 1Algorithm整理一下题意:翻转一棵二叉树。首先想到的当然是递归解法。对每个节点,都翻转左右子树。代码如下。//递归版本,用时0原创 2016-12-15 16:46:46 · 327 阅读 · 0 评论 -
LeetCode #404 - Sum of Left Leaves - Easy
ProblemFind the sum of all left leaves in a given binary tree.Example 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24.原创 2016-12-15 16:58:09 · 293 阅读 · 0 评论