摘要:
#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 阅读全文
摘要:
#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 阅读全文
摘要:
#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++){ ... 阅读全文
摘要:
#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... 阅读全文