2014年5月13日

摘要: Problem Link:http://oj.leetcode.com/problems/minimum-depth-of-binary-tree/To find the minimum depth, we BFS from the root and record the depth. For ea... 阅读全文

posted @ 2014-05-13 22:53 卢泽尔 阅读(144) 评论(0) 推荐(0)

摘要: Problem Link:http://oj.leetcode.com/problems/path-sum-ii/The basic idea here is same to that of Path Sum. However, since the problem is asking for all... 阅读全文

posted @ 2014-05-13 22:46 卢泽尔 阅读(190) 评论(0) 推荐(0)

摘要: Problem Link:http://oj.leetcode.com/problems/path-sum/One solution is to BFS the tree from the root, and for each leaf we check if the path sum equals... 阅读全文

posted @ 2014-05-13 22:39 卢泽尔 阅读(242) 评论(0) 推荐(0)

摘要: Problem Link:http://oj.leetcode.com/problems/flatten-binary-tree-to-linked-list/The problem is asking for flatterning a binary tree to linked list by ... 阅读全文

posted @ 2014-05-13 22:19 卢泽尔 阅读(152) 评论(0) 推荐(0)

摘要: Problem Link:http://oj.leetcode.com/problems/distinct-subsequences/A classic problem using Dynamic Programming technique.Let m and n be the length of ... 阅读全文

posted @ 2014-05-13 11:07 卢泽尔 阅读(174) 评论(0) 推荐(0)

摘要: Problem Link:http://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/OK... Exactly same to Populating Next Right Pointers in Ea... 阅读全文

posted @ 2014-05-13 10:09 卢泽尔 阅读(112) 评论(0) 推荐(0)

摘要: Problem Link:http://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/Just traverse the tree from the root, level by level. Esay en... 阅读全文

posted @ 2014-05-13 10:07 卢泽尔 阅读(204) 评论(0) 推荐(0)

摘要: Problem Link:http://oj.leetcode.com/problems/pascals-triangle-ii/Let T[i][j] be the j-th element of the i-th row in the triangle, for 0 <= j <= i, i =... 阅读全文

posted @ 2014-05-13 09:19 卢泽尔 阅读(118) 评论(0) 推荐(0)

摘要: Prolbem Link:http://oj.leetcode.com/problems/pascals-triangle/Just a nest-for-loop...class Solution: # @return a list of lists of integers def g... 阅读全文

posted @ 2014-05-13 08:52 卢泽尔 阅读(142) 评论(0) 推荐(0)