Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1/** * Definition for a binary tree node...
分类:
其他好文 时间:
2015-06-12 18:58:42
阅读次数:
91
Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.For example:
Given the below binary tree and sum = 22, 5
/ \...
分类:
其他好文 时间:
2015-06-12 17:17:40
阅读次数:
84
Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem w...
分类:
其他好文 时间:
2015-06-12 16:58:39
阅读次数:
71
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1递归实现def invert_tree(root) root.right...
分类:
其他好文 时间:
2015-06-12 16:57:50
阅读次数:
70
problems: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".class Solution {public: string...
分类:
其他好文 时间:
2015-06-12 16:40:21
阅读次数:
71
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the total sum of al...
分类:
其他好文 时间:
2015-06-12 14:55:41
阅读次数:
100
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1
/ 2 2
/ \ / 3 4 4 3
But the following is not...
分类:
其他好文 时间:
2015-06-12 10:13:12
阅读次数:
166
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:
其他好文 时间:
2015-06-12 10:02:42
阅读次数:
90
算法-Skew数关键字一关键字二题目描述输入输出样例输入样例输出来源解题思路关键点完整代码题目描述在 skew binary表示中, 第 k 位的值xk表示xk*(2^(k+1)-1)。 每个位上的可能数字是0 或 1,最后面一个非零位可以是2, 例如, 10120(skew) = 1*(2^5-1...
分类:
编程语言 时间:
2015-06-11 22:27:07
阅读次数:
187
Given a binary tree, return the inorder traversal of its nodes’ values.For example:
Given binary tree {1,#,2,3}, 1
2
/
3return[1,3,2].递归遍历法:/**
* Definition for a binary tree node...
分类:
其他好文 时间:
2015-06-11 21:19:57
阅读次数:
113