Given a binary tree, return the postorder traversal of its nodes’ values.For example:
Given binary tree {1,#,2,3}, 1
2
/
3return [3,2,1].Note: Recursive solution is trivial, could...
分类:
其他好文 时间:
2015-06-13 11:23:14
阅读次数:
113
Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).For example:
Given binary tree {3,9,20,#,#,15,7}, 3
/ 9 20
/ 1...
分类:
其他好文 时间:
2015-06-13 11:20:46
阅读次数:
114
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.
题目解析:
将一个矩阵中0所在行,以及所在列都置为0.
方法一:
将矩阵中,0的行和列的下标保存下来,并且分别去除里面重复的下标,之后遍历矩阵,将记录的这些行和列均置为0.代码如下:
cla...
分类:
其他好文 时间:
2015-06-13 09:52:50
阅读次数:
110
The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and no...
分类:
其他好文 时间:
2015-06-12 23:46:18
阅读次数:
168
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2015-06-12 23:40:02
阅读次数:
121
One of the biggest advantages of Skype is its simple and mostly free video calling function. But what if you need to record a video call, or if you wo...
分类:
其他好文 时间:
2015-06-12 18:52:23
阅读次数:
102
下载源码包系统的最低要求: 6GB 硬盘 ; 2GB RAM.命令行工具:A C/C++ compiler: Since Sage builds its own GCC if needed, a wide variety of C/C++ compilers is supported.Many GC...
分类:
系统相关 时间:
2015-06-12 14:44:27
阅读次数:
325
Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corner as shown ...
分类:
其他好文 时间:
2015-06-12 11:35:36
阅读次数:
107
No.223 Rectangle AreaFind the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top r...
分类:
其他好文 时间:
2015-06-12 11:35:32
阅读次数:
83
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