摘要:
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 ... 阅读全文
摘要:
class Solution {public: // verbose one vector insert(vector &intervals, Interval newInterval) { vector ret; int ns = newInterval.s... 阅读全文
摘要:
/** * 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... 阅读全文