摘要: class Solution { public: int method(vector<int> h)//求柱状图中最大的矩形 { int n=h.size(); vector<int> l=vector<int> (n),r=l; stack<int> st; //预处理l,r数组 for(int 阅读全文
posted @ 2023-04-01 11:16 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> res; vector<int> path; void dfs(TreeNode* root, int sum,int t) { t+=root->val; path.push_back(root->val); 阅读全文
posted @ 2023-04-01 09:55 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0)
摘要: class Solution { public: bool dfs(vector<int> q,int l,int r) { if(l>=r) return true; int root=q[r]; int idx=l; for (; idx < r; idx ++ ) if(q[idx]>root 阅读全文
posted @ 2023-04-01 09:20 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0)