摘要:
第一次没考虑到要加个系数cur, 因为必须从小到大排序,导致答案里有[1, 2]和[2, 1],加入cur后就acm了 1 class Solution { 2 public: 3 void dfs(vector candidates, int target, int sum, vector... 阅读全文
摘要:
一开始用dfs结果large超时,马上就想到dp了。。哎,下次先得去想dp啊。。 1 class Solution { 2 public: 3 int climbStairs(int n) { 4 // Start typing your C/C++ solution bel... 阅读全文
摘要:
出错了一次,改了一次,小失误没用弄好zigzag的排序。题目还是简单的 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * T... 阅读全文
摘要:
这题比较难,没理顺关系,做了很多次还只是过了small judge,于是去看网上答案,然后再改了改,关键在于local_max和globe_max,globe_max要随时改得,而maxsum函数只是返回最大路径 1 /** 2 * Definition for binary tree 3 * ... 阅读全文