上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页
摘要: 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)
摘要: class Solution { public: int largestRectangleArea(vector<int>& h) { vector<int> l=vector<int>(h.size()); vector<int> r=l; stack<int> stk; int res=0; / 阅读全文
posted @ 2023-03-31 16:47 穿过雾的阴霾 阅读(15) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> res; void bfs(TreeNode* root) { queue<TreeNode*> q; q.push(root); int level=0; while(q.size ()) { int siz 阅读全文
posted @ 2023-03-31 09:21 穿过雾的阴霾 阅读(17) 评论(0) 推荐(0)
摘要: class Solution { public: vector<int> res; void bfs(TreeNode* root) { queue<TreeNode*> q; q.push(root); while(q.size ()) { auto p=q.front(); q.pop(); r 阅读全文
posted @ 2023-03-31 09:10 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> res; void bfs(TreeNode* root) { queue<TreeNode*> q; q.push(root); while(q.size ()) { int size=q.size(); v 阅读全文
posted @ 2023-03-31 09:10 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0)
摘要: class Solution { public: bool isPopOrder(vector<int> pushV,vector<int> popV) { stack<int> st; int n=pushV.size(),m=popV.size(); if(n!=m) return false; 阅读全文
posted @ 2023-03-30 13:40 穿过雾的阴霾 阅读(15) 评论(0) 推荐(0)
摘要: class Solution { public: ListNode* deleteDuplicates(ListNode* head) { ListNode* dummy=new ListNode(-1,nullptr); if(!head||!head->next) return head; Li 阅读全文
posted @ 2023-03-30 13:32 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0)
摘要: class MinStack { public: stack<int> st;//普通栈 stack<int> stMin;//单调栈 /** initialize your data structure here. */ MinStack() { } void push(int x) { st.p 阅读全文
posted @ 2023-03-29 15:41 穿过雾的阴霾 阅读(15) 评论(0) 推荐(0)
摘要: class Solution { public: int turn,n,m; static const int N=410; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};//右下左上 bool st[N][N]; bool check(int i 阅读全文
posted @ 2023-03-29 14:52 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0)
摘要: class Solution { public: bool check(vector<int> &nums,int target,int l,int r)//[l,r]区间查找target { while(l<r) { int mid=(l+r+1)>>1; if(target>=nums[mid] 阅读全文
posted @ 2023-03-28 20:48 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页