2012年12月18日
摘要: #include <iostream>#include <vector>#include <stack>#include <queue>using namespace std;struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {}};class Solution {public: vector<vector<int> > levelOrder(TreeNo 阅读全文
posted @ 2012-12-18 23:59 kkmm 阅读(233) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <vector>#include <stack>#include <queue>using namespace std;struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {}};/*本题心得:0 如何分析一个问题1 没有固定格式的判断方式2 越界*/class Solution {public: int maxPathSum 阅读全文
posted @ 2012-12-18 23:48 kkmm 阅读(869) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <vector>#include <stack>#include <queue>using namespace std;class Solution {public: string countAndSay(int n) {//调用process N次 if (n<1) return ""; string str = "1"; if (n == 1) return str; for (int i = 1; i < n; i++){ ... 阅读全文
posted @ 2012-12-18 23:47 kkmm 阅读(1102) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;void QuickSortCore(int a[], int start, int end){ if (start > end) return; int key = a[start]; int blank = start; int left = start + 1; int right = end; while(left <= right){//维护left right blank key if (blank < left){ i... 阅读全文
posted @ 2012-12-18 23:46 kkmm 阅读(186) 评论(0) 推荐(0) 编辑