会员
周边
众包
新闻
博问
闪存
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
穿过雾的阴霾
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
9
10
11
12
13
14
15
16
17
···
20
下一页
2023年4月1日
二叉搜索树的后序遍历序列
摘要: 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)
2023年3月31日
84. 柱状图中最大的矩形
摘要: 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)
2023年3月30日
栈的压入,弹出序列
摘要: 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)
82. 删除排序链表中的重复元素 II
摘要: 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)
2023年3月29日
包含min函数的栈
摘要: 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)
2023年3月28日
Leetcode81. 搜索旋转排序数组 II
摘要: 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
下一页
公告