摘要: 1 class Solution { 2 public: 3 int numTrees(int n) { 4 return dfs(1, n); 5 } 6 7 int dfs(int start, int end) { 8 if ... 阅读全文
posted @ 2014-03-24 23:53 卖程序的小歪 阅读(160) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: // verbose one vector insert(vector &intervals, Interval newInterval) { vector ret; int ns = newInterval.s... 阅读全文
posted @ 2014-03-24 18:50 卖程序的小歪 阅读(194) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: bool hasPathSum(TreeNode *root, int sum) { return dfs(root, 0, sum); } bool d... 阅读全文
posted @ 2014-03-24 16:06 卖程序的小歪 阅读(151) 评论(0) 推荐(0) 编辑