会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
番茄随想
Do not go gentle into that good night
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
下一页
2023年8月26日
[刷题记录Day20]Leetcode二叉树
摘要: # No.1 ## 题目 [最大二叉树](https://leetcode.cn/problems/maximum-binary-tree/) ## 思路 - 递归法 - 注意保持区间定义一致`[left, right)` ## 递归分析 1. **返回值**:节点,**参数**:数组,起点,终点
阅读全文
posted @ 2023-08-26 02:13 喜欢毛绒绒的番茄子
阅读(7)
评论(0)
推荐(0)
2023年8月25日
[刷题记录Day18]Leetcode二叉树
摘要: # No.1 ## 题目 [找树左下角的值](https://leetcode.cn/problems/find-bottom-left-tree-value/) ## 思路 - 队列,层序遍历 - Deque既可以用作栈也可以用作队列,谨慎使用 ## 代码 ```Java public int f
阅读全文
posted @ 2023-08-25 23:38 喜欢毛绒绒的番茄子
阅读(5)
评论(0)
推荐(0)
[刷题记录Day17]Leetcode二叉树
摘要: # No.1 ## 题目 [平衡二叉树](https://leetcode.cn/problems/balanced-binary-tree/) ## 思路 - 递归法 - 在遍历中比较左右子树的高度差 ## 递归分析 1. **参数**:当前传入节点。 **返回值**:以当前传入节点为根节点的树的
阅读全文
posted @ 2023-08-25 23:38 喜欢毛绒绒的番茄子
阅读(5)
评论(0)
推荐(0)
[刷题记录Day16]Leetcode二叉树
摘要: # No.1 ## 题目 [二叉树的最大深度](https://leetcode.cn/problems/maximum-depth-of-binary-tree/) ## 思路 - 递归 - 其实是后序遍历的方式 ## 代码 ```Java public int maxDepth(TreeNode
阅读全文
posted @ 2023-08-25 23:37 喜欢毛绒绒的番茄子
阅读(5)
评论(0)
推荐(0)
[刷题记录Day15]Leetcode二叉树
摘要: # No.1 ## 题目 [二叉树的层序遍历](https://leetcode.cn/problems/binary-tree-level-order-traversal/) ## 思路 - 使用队列 - 关键点:1. 每进入一层,层内的节点都被处理完成 2. 开始遍历层内的节点前,必须先记录该层
阅读全文
posted @ 2023-08-25 23:37 喜欢毛绒绒的番茄子
阅读(5)
评论(0)
推荐(0)
[刷题记录Day14]Leetcode二叉树
摘要: # No.1 ## 题目 [前序遍历](https://leetcode.cn/problems/binary-tree-preorder-traversal/) ## 思路 - 递归法 ## 代码 ```Java public void Traverse(TreeNode node, List l
阅读全文
posted @ 2023-08-25 23:36 喜欢毛绒绒的番茄子
阅读(7)
评论(0)
推荐(0)
[刷题记录Day13]Leetcode
摘要: # No.1 ## 题目 [滑动窗口最大值](https://leetcode.cn/problems/sliding-window-maximum/) ## 思路 - 编写单调队列类 - [讲解](https://programmercarl.com/0239.%E6%BB%91%E5%8A%A8
阅读全文
posted @ 2023-08-25 23:20 喜欢毛绒绒的番茄子
阅读(11)
评论(0)
推荐(0)
[刷题记录Day11]Leetcode
摘要: # No.1 ## 题目 [有效的括号](https://leetcode.cn/problems/valid-parentheses/) ## 思路 - 奇数个符号一定不符合 - 分析括号不匹配的可能性 - 第一种情况,字符串里左方向的括号多余了 ,所以不匹配 ![[brackets0.png]]
阅读全文
posted @ 2023-08-25 23:20 喜欢毛绒绒的番茄子
阅读(3)
评论(0)
推荐(0)
[刷题记录Day10]Leetcode
摘要: # No.1 ## 题目 [用栈实现队列](https://leetcode.cn/problems/implement-queue-using-stacks/) ## 思路 - 模拟 - 一个入栈一个出栈 ## 代码 ```Java class MyQueue { private Stack st
阅读全文
posted @ 2023-08-25 23:19 喜欢毛绒绒的番茄子
阅读(5)
评论(0)
推荐(0)
[刷题记录Day9]Leetcode
摘要: >建议跳过 # No.1 ## 题目 [找出字符串中第一个匹配项的下标](https://leetcode.cn/problems/find-the-index-of-the-first-occurrence-in-a-string/) ## 思路 - KMP ## 代码 ```Java ``` #
阅读全文
posted @ 2023-08-25 23:04 喜欢毛绒绒的番茄子
阅读(3)
评论(0)
推荐(0)
上一页
1
2
3
下一页
公告