摘要: class Solution { public: vector<vector<int> > combine(int n, int k) { vector<int> vecTmp; m_vecRet.clear(); combination(1, n,... 阅读全文
posted @ 2012-09-01 21:08 紫红的泪 阅读(350) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int> > combinationSum2(vector<int> &num, int target) { vector<int> vecTmp; m_vecRet.clear(); ... 阅读全文
posted @ 2012-09-01 20:43 紫红的泪 阅读(1219) 评论(2) 推荐(0)
摘要: class Solution { public: vector<vector<int> > combinationSum(vector<int> &candidates, int target) { vector<int> vecTmp; m_vecRet.clear(); ... 阅读全文
posted @ 2012-09-01 19:45 紫红的泪 阅读(1305) 评论(0) 推荐(0)
摘要: 爬楼梯,就是斐波纳契数列。 // f(n) = f(n - 1) + f(n - 2). // f(1) = 1. // f(2) = 2. int climbStairs(int n) { int a = 1, b = 2; int c = 0; if (n == 1) return a... 阅读全文
posted @ 2012-09-01 17:18 紫红的泪 阅读(1487) 评论(0) 推荐(0)
摘要: 实现二叉树中序非递归遍历。 /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left... 阅读全文
posted @ 2012-09-01 17:10 紫红的泪 阅读(1486) 评论(0) 推荐(0)