Eagle233-Blog

Categories StackAndQueue

7 posts

[Algorithms] LeetCode 347. 前 K 个高频元素


Categories Algorithms StackAndQueue | Tags

来源:代码随想录 LeetCode 347. 前 K 个高频元素 优先队列 小顶堆重载的操作必须是公开的;元素、底层容器、比较函数被定义在优先队列中;输出要倒序。 取出头部元素竟然用的是qu...

[Algorithms] LeetCode 239. 滑动窗口最大值


Categories Algorithms StackAndQueue | Tags

来源:代码随想录 LeetCode 239. 滑动窗口最大值 自定义单调队列注意检查非空;注意第一次要加入最大值;注意单调队列如何维持;注意弹出时要判断是否需要弹出。 class Solut...

[Algorithms] LeetCode 150. 逆波兰表达式求值


Categories Algorithms StackAndQueue | Tags

来源:代码随想录 LeetCode 150. 逆波兰表达式求值 栈模拟注意string的输入输出处理,小心负数。 class Solution { public: int ...

[Algorithms] LeetCode 1047. 删除字符串中的所有相邻重复项


Categories Algorithms StackAndQueue | Tags

来源:代码随想录 LeetCode 1047. 删除字符串中的所有相邻重复项 栈模拟注意是两两删除。 class Solution { public: string rem...

[Algorithms] LeetCode 20. 有效的括号


Categories Algorithms StackAndQueue | Tags

来源:代码随想录 LeetCode 20. 有效的括号 栈模拟注意最后判断空栈。 class Solution { public: bool isValid(string ...

[Algorithms] LeetCode 225. 用队列实现栈


Categories Algorithms StackAndQueue | Tags

来源:代码随想录 LeetCode 225. 用队列实现栈 单个队列模拟栈class MyStack { public: queue<int> que; ...

[Algorithms] LeetCode 232.用栈实现队列


Categories Algorithms StackAndQueue | Tags

来源:代码随想录 LeetCode 232.用栈实现队列 直观的方法效率不高。 class MyQueue { public: stack<int> in; ...


© 2025 Eagle233
Powered By Hexo & Theme mdsuper
Search