- 博客(21)
- 收藏
- 关注
原创 leetcode每日更新 5/31
Table of Contents581.Shortest Unsorted Continuous Subarray617.Merge Two Binary Trees647.Palindromic Substrings771.Jewels and Stones581.Shortest Unsorted Continuous Subarrayhttps://leetcode.com/problems/shortest-unsorted-continuous-subarray...
2020-06-01 09:53:09
94
原创 leetcode每日更新 5/30
Table of Contents538.Convert BST to Greater Tree543.Diameter of Binary Tree560.Subarray Sum Equals K572.Subtree of Another Tree538.Convert BST to Greater Treehttps://leetcode.com/problems/convert-bst-to-greater-tree/Binary Tree, Recur...
2020-05-31 12:03:45
81
原创 leetcode每日更新 5/29
448.Find All Numbers Disappeared in an Arrayhttps://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/Arrayclass Solution { public List<Integer> findDisappearedNumbers(int[] nums) { for(int i = 0; i < nums.lengt...
2020-05-30 12:35:02
82
原创 leetcode每日更新 5/28
Table of Contents406.Queue Reconstruction by Height416.Partition Equal Subset Sum437.Path Sum III438.Find All Anagrams in a String406.Queue Reconstruction by Heighthttps://leetcode.com/problems/queue-reconstruction-by-height/Array, Greed...
2020-05-29 12:51:40
96
原创 leetcode每日更新 5/27
337.House Robber IIIhttps://leetcode.com/problems/house-robber-iii/Recursion, DFSclass 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
88
原创 leetcode每日更新 5/26
Table of Contents309.Best Time to Buy and Sell Stock with Cooldown312.Burst Balloons322.Coin Change309.Best Time to Buy and Sell Stock with Cooldownhttps://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/DPStates: (...
2020-05-27 12:27:02
74
原创 leetcode每日更新 5/25
240.Search a 2D Matrix IIhttps://leetcode.com/problems/search-a-2d-matrix-ii/
2020-05-26 10:40:20
71
原创 leetcode每日更新 5/24
236.Lowest Common Ancestor of a Binary Treehttps://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
67
原创 leetcode每日更新 5/23
206.Reverse Linked Listhttps://leetcode.com/problems/reverse-linked-list/LinkedList, RecursionInput: 1 -> 2 -> 3 -> 4 -> 5 -> NULLExpected Output: 5 -> 4 -> 3 -> 2 -> 1 -> NULLListNode reverseList(4) { newHead = .
2020-05-24 13:07:50
65
原创 leetcode每日更新 5/22
152.Maximum Product Subarrayhttps://leetcode.com/problems/maximum-product-subarray/Array, DPNeed both pre-min and pre-max to calculate productSimiliar Question:53.Maximum Subarray155.Min Stackhttps://leetcode.com/problems/min-stack/submi...
2020-05-23 02:56:15
104
原创 leetcode每日更新 5/20
128.Longest Consecutive Sequencehttps://leetcode.com/problems/longest-consecutive-sequence/HashSet,while(!set.contains(num - 1))Time: O(n)Space: O(n)136.Single Numberhttps://leetcode.com/problems/single-number/Bit Manipulation139....
2020-05-21 12:05:51
62
原创 leetcode每日更新 5/19
101.Symmetric Treehttps://leetcode.com/problems/symmetric-tree/Tree, Recursion102.Binary Tree Level Order Traversalhttps://leetcode.com/problems/binary-tree-level-order-traversal/Tree, BFS104.Maximum Depth of Binary Treehttps://leetc...
2020-05-20 12:23:41
65
原创 leetcode每日更新 5/18
84.Largest Rectangle in Histogramhttps://leetcode.com/problems/largest-rectangle-in-histogram/two-way DPM1[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
77
原创 leetcode每日更新 5/17
75.Sort Colorshttps://leetcode.com/problems/sort-colors/Two PointersLeft 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
67
原创 leetcode每日更新 5/15
64.Minimum Path Sumhttps://leetcode.com/problems/minimum-path-sum/DP70.Climbing Stairshttps://leetcode.com/problems/climbing-stairs/DP72.Edit Distancehttps://leetcode.com/problems/edit-distance/DP
2020-05-16 12:51:01
69
1
原创 leetcode每日更新 5/14
53.Maximum Subarrayhttps://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 Gamehttps:/...
2020-05-15 12:09:54
60
原创 leetcode每日更新 5/13
46.Permutationshttps://leetcode.com/problems/permutations/Backtracking, RecursionInput Array: Use in-place swap-swap to save spaceConclusion:Whenever every single permutation containsall elementsin the initial input,their only difference is th...
2020-05-14 12:00:18
60
原创 leetcode每日更新 5/12
21.Merge Two Sorted Listshttps://leetcode.com/problems/merge-two-sorted-lists/LinkedList谁小移谁22.Generate Parentheseshttps://leetcode.com/problems/generate-parentheses/Backtracking, Combination23.Merge k Sorted Listshttps://leetcode....
2020-05-13 11:46:25
135
原创 leetcode每日更新 5/11
5.Longest Palindromic Substringhttps://leetcode.com/problems/longest-palindromic-substring/String, Expand around centerTime: O(n2) Space: constant10.Regular Expression MatchingHard -Given an input string (s) and a pattern (p), implement r...
2020-05-12 11:22:04
132
原创 leetcode每日更新 5/10
1. Two Sumhttps://leetcode.com/problems/two-sum/HashMapTime: O(n) - One passSpace: O(n) -extra space for HashMap2. Add Two Numbershttps://leetcode.com/problems/add-two-numbers/LinkedListAlways know where the head location is. Need anoth..
2020-05-11 12:30:43
126
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人