- 博客(21)
- 收藏
- 关注
原创 leetcode每日更新 5/31
Table of Contents 581.Shortest Unsorted Continuous Subarray 617.Merge Two Binary Trees 647.Palindromic Substrings 771.Jewels and Stones 581.Shortest Unsorted Continuous Subarray https://leetcode.com/problems/shortest-unsorted-continuous-subarray...
2020-06-01 09:53:09
216
原创 leetcode每日更新 5/30
Table of Contents 538.Convert BST to Greater Tree 543.Diameter of Binary Tree 560.Subarray Sum Equals K 572.Subtree of Another Tree 538.Convert BST to Greater Tree https://leetcode.com/problems/convert-bst-to-greater-tree/ Binary Tree, Recur...
2020-05-31 12:03:45
124
原创 leetcode每日更新 5/29
448.Find All Numbers Disappeared in an Array https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/ Array class Solution { public List<Integer> findDisappearedNumbers(int[] nums) { for(int i = 0; i < nums.lengt...
2020-05-30 12:35:02
128
原创 leetcode每日更新 5/28
Table of Contents 406.Queue Reconstruction by Height 416.Partition Equal Subset Sum 437.Path Sum III 438.Find All Anagrams in a String 406.Queue Reconstruction by Height https://leetcode.com/problems/queue-reconstruction-by-height/ Array, Greed...
2020-05-29 12:51:40
151
原创 leetcode每日更新 5/27
337.House Robber III https://leetcode.com/problems/house-robber-iii/ Recursion, DFS class Solution { public int rob(TreeNode root) { if(root == null) return 0; int[] res = dfs(root); return Math.max(res[0], res[1]); ...
2020-05-28 12:44:50
133
原创 leetcode每日更新 5/26
Table of Contents 309.Best Time to Buy and Sell Stock with Cooldown 312.Burst Balloons 322.Coin Change 309.Best Time to Buy and Sell Stock with Cooldown https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/ DP States: (...
2020-05-27 12:27:02
123
原创 leetcode每日更新 5/25
240.Search a 2D Matrix II https://leetcode.com/problems/search-a-2d-matrix-ii/
2020-05-26 10:40:20
116
原创 leetcode每日更新 5/24
236.Lowest Common Ancestor of a Binary Tree https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ Binary Tree, LCA 1. if left subtree returns NULL and right subtree returns NULL, return NULL 2. if left subtree AND right subtree .
2020-05-25 12:24:56
108
原创 leetcode每日更新 5/23
206.Reverse Linked List https://leetcode.com/problems/reverse-linked-list/ LinkedList, Recursion Input: 1 -> 2 -> 3 -> 4 -> 5 -> NULL Expected Output: 5 -> 4 -> 3 -> 2 -> 1 -> NULL ListNode reverseList(4) { newHead = .
2020-05-24 13:07:50
115
原创 leetcode每日更新 5/22
152.Maximum Product Subarray https://leetcode.com/problems/maximum-product-subarray/ Array, DP Need both pre-min and pre-max to calculate product Similiar Question:53.Maximum Subarray 155.Min Stack https://leetcode.com/problems/min-stack/submi...
2020-05-23 02:56:15
229
原创 leetcode每日更新 5/20
128.Longest Consecutive Sequence https://leetcode.com/problems/longest-consecutive-sequence/ HashSet, while(!set.contains(num - 1)) Time: O(n) Space: O(n) 136.Single Number https://leetcode.com/problems/single-number/ Bit Manipulation 139....
2020-05-21 12:05:51
107
原创 leetcode每日更新 5/19
101.Symmetric Tree https://leetcode.com/problems/symmetric-tree/ Tree, Recursion 102.Binary Tree Level Order Traversal https://leetcode.com/problems/binary-tree-level-order-traversal/ Tree, BFS 104.Maximum Depth of Binary Tree https://leetc...
2020-05-20 12:23:41
117
原创 leetcode每日更新 5/18
84.Largest Rectangle in Histogram https://leetcode.com/problems/largest-rectangle-in-histogram/ two-way DP M1[i] represents from 0 to i, the largest index whose element has less value than index i. (left border, exclusive) M2[i] represents from n - 1 .
2020-05-19 12:48:38
119
原创 leetcode每日更新 5/17
75.Sort Colors https://leetcode.com/problems/sort-colors/ Two Pointers Left Boundary: the numbers whose index is less than [left] are all 0; Right Boundary: the numbers whose index is greater than [right] are all 2; Between [left] and [right] are all.
2020-05-18 12:30:25
111
原创 leetcode每日更新 5/15
64.Minimum Path Sum https://leetcode.com/problems/minimum-path-sum/ DP 70.Climbing Stairs https://leetcode.com/problems/climbing-stairs/ DP 72.Edit Distance https://leetcode.com/problems/edit-distance/ DP
2020-05-16 12:51:01
139
1
原创 leetcode每日更新 5/14
53.Maximum Subarray https://leetcode.com/problems/maximum-subarray/ DP - dp[i] means the maximum subarray ending with nums[i] - dp[0] = nums[0] - dp[i] = (dp[i - 1] > 0 ? dp[i - 1] : 0) + nums[i] Time: O(n) Space: O(n) 55.Jump Game https:/...
2020-05-15 12:09:54
101
原创 leetcode每日更新 5/13
46.Permutations https://leetcode.com/problems/permutations/ Backtracking, Recursion Input Array: Use in-place swap-swap to save space Conclusion:Whenever every single permutation containsall elementsin the initial input,their only difference is th...
2020-05-14 12:00:18
99
原创 leetcode每日更新 5/12
21.Merge Two Sorted Lists https://leetcode.com/problems/merge-two-sorted-lists/ LinkedList 谁小移谁 22.Generate Parentheses https://leetcode.com/problems/generate-parentheses/ Backtracking, Combination 23.Merge k Sorted Lists https://leetcode....
2020-05-13 11:46:25
190
原创 leetcode每日更新 5/11
5.Longest Palindromic Substring https://leetcode.com/problems/longest-palindromic-substring/ String, Expand around center Time: O(n2) Space: constant 10.Regular Expression Matching Hard - Given an input string (s) and a pattern (p), implement r...
2020-05-12 11:22:04
179
原创 leetcode每日更新 5/10
1. Two Sum https://leetcode.com/problems/two-sum/ HashMap Time: O(n) - One pass Space: O(n) -extra space for HashMap 2. Add Two Numbers https://leetcode.com/problems/add-two-numbers/ LinkedList Always know where the head location is. Need anoth..
2020-05-11 12:30:43
261
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅