摘要: class Solution {public: int minimumTotal(vector > &triangle) { if (triangle.size() == 0) return 0; vector f(triangle[triangle.size()-1].size()); f[0] = triangle[0][0]; for(int i = 1; i = 0; j--) if (j == 0) f[j] = f[j] + triangle[i][j]; else if (j == t... 阅读全文
posted @ 2013-09-03 21:08 代码改变未来 阅读(234) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: double pow(double x, int n) { double a=1; if(n==0)return 1; if(x==1)return 1; if(x==-1) { if(n&1)return -1; else return 1; } int absn=abs(n); a=power(x,absn); if(n>1); r... 阅读全文
posted @ 2013-09-03 14:26 代码改变未来 阅读(398) 评论(0) 推荐(0) 编辑
摘要: dfsclass Solution {public:string str[8]={"abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};vectors; vector letterCombinations(string digits) { s.clear(); dfs(digits,""); return s; } void dfs(string digits,stri 阅读全文
posted @ 2013-09-03 12:56 代码改变未来 阅读(1018) 评论(0) 推荐(0) 编辑