摘要: 53. 最大子数组和 https://leetcode.cn/problems/maximum-subarray/description/?envType=study-plan-v2&envId=top-100-liked public int maxSubArray(int[] nums) { i 阅读全文
posted @ 2024-03-26 16:09 jeasonGo 阅读(16) 评论(0) 推荐(0)
摘要: 155. 最小栈 https://leetcode.cn/problems/min-stack/description/?envType=study-plan-v2&envId=top-100-liked class MinStack { Deque<Integer> deque; Priority 阅读全文
posted @ 2024-03-24 14:46 jeasonGo 阅读(22) 评论(0) 推荐(0)
摘要: 513. 找树左下角的值 https://leetcode.cn/problems/find-bottom-left-tree-value/description/ public int findBottomLeftValue(TreeNode root) { int val = 0; Deque< 阅读全文
posted @ 2024-03-23 13:15 jeasonGo 阅读(35) 评论(0) 推荐(0)
摘要: 215. 数组中的第K个最大元素 https://leetcode.cn/problems/kth-largest-element-in-an-array/description/?envType=study-plan-v2&envId=top-100-liked public int findKt 阅读全文
posted @ 2024-03-23 09:59 jeasonGo 阅读(22) 评论(0) 推荐(0)
摘要: 110. 平衡二叉树 https://leetcode.cn/problems/balanced-binary-tree/description/ public boolean isBalanced(TreeNode root) { int balance = balance(root); retu 阅读全文
posted @ 2024-03-22 10:51 jeasonGo 阅读(14) 评论(0) 推荐(0)
摘要: 35. 搜索插入位置 https://leetcode.cn/problems/search-insert-position/description/?envType=study-plan-v2&envId=top-100-liked public int searchInsert(int[] nu 阅读全文
posted @ 2024-03-22 09:55 jeasonGo 阅读(35) 评论(0) 推荐(0)
摘要: 104. 二叉树的最大深度 https://leetcode.cn/problems/maximum-depth-of-binary-tree/description/ public int maxDepth(TreeNode root) { return max(root); } public i 阅读全文
posted @ 2024-03-21 10:44 jeasonGo 阅读(15) 评论(0) 推荐(0)
摘要: 226. 翻转二叉树 https://leetcode.cn/problems/invert-binary-tree/description/ public TreeNode invertTree(TreeNode root) { invert(root); return root; } publi 阅读全文
posted @ 2024-03-20 10:30 jeasonGo 阅读(20) 评论(0) 推荐(0)
摘要: 二叉树的递归遍历 递归三要素:确定递归函数的参数和返回值,确定终止条件,确定单层递归的逻辑 144. 二叉树的前序遍历 https://leetcode.cn/problems/binary-tree-preorder-traversal/description/ public List<Integ 阅读全文
posted @ 2024-03-19 10:23 jeasonGo 阅读(10) 评论(0) 推荐(0)