根據一畝三分地胖頭龍帖子順序刷題的記錄...
History
Number | Similar | Requirement | Title | Category | First attampt | Most recenet attamp | Success rate | Comments |
---|---|---|---|---|---|---|---|---|
704 | Required | Binary Search | Binary Search | 09/07/2022 | 09/07/2022 | 1/1 | mid = left + (right - left) / 2 防止溢出 | |
34 | Core | Find First and Last Position of Element in Sorted Array | Binary Search | 09/07/2022 | 09/07/2022 | 0/1 | 修改二分繼續查找的條件,同時更新邊界 index | |
702 | Core | Search in a Sorted Array of Unknown Size | Binary Search | 09/08/2022 | 09/08/2022 | 1/1 | 先確定邊界,再二分 | |
153 | Important | Find Minimum in Rotated Sorted Array | Binary Search | 09/08/2022 | 09/08/2022 | 0/1 | 最小值左側大於 arr[-1],最小值右側小於 arr[-1] | |
154 | Important | Find Minimum in Rotated Sorted Array II | Binary Search | 09/08/2022 | 09/08/2022 | 0/1 | 如果相等,直接扔掉 hi,反正有 mid 留著就行 | |
278 | Important | First Bad Version | Binary Search | 09/08/2022 | 09/08/2022 | 1/1 | 簡單二分法 | |
658 | Important | Find K Closest Elements | Binary Search | 09/10/2022 | 09/10/2022 | 0/1 | 雙指針/先二分找最近的 | |
33 | Required | Search in Rotated Sorted Array | Binary Search | 09/10/2022 | 09/10/2022 | 1/1 | 分段單調之後分類討論,注意分類要分清楚 | |
81 | Required | Search in Rotated Sorted Array II | Binary Search | 09/10/2022 | 09/10/2022 | 0/1 | 要考慮到是可以重複的, hi -= 1 即可;注意複雜度是 O(n),可能需要綫性查找全部元素 | |
4 | Core | Median of Two Sorted Arrays | Binary Search | 09/10/2022 | 09/10/2022 | 0/1 | 雙指針很簡單,二分裏面 A[i-1] <= B[j], A[j-1] <= A[i]等價於最大的 i 使得 A[i-1]<=B[j]成立,同時注意 Java 會超過 Integer 範圍,所以要用 med 保存中間過程 | |
74 | Core | Search a 2D Matrix | Binary Search | 09/12/2022 | 09/12/2022 | 1/1 | ||
240 | 74 Follow Up | Search a 2D Matrix II | Binary Search | 09/12/2022 | 09/12/2022 | 1/1 | 普通對行二分注意用首尾加速;注意到矩陣元素向左變小向下變大,類似二分法 | |
162 | Core | Find Peak Element | Binary Search | 09/12/2022 | 09/12/2022 | 0/1 | 綫性掃描注意防止 Integer 溢出,二分要説明正確性 | |
302 | Important | Smallest Rectangle Enclosing Black Pixels | Binary Search | 09/14/2022 | 09/14/2022 | 0/1 | 暴力很簡單,BFS 或者二分理解下 | |
852 | Important | Peak Index in a Mountain Array | Binary Search | 09/14/2022 | 09/14/2022 | 1/1 | ||
875 | Core | Koko Eating Bananas | Binary Search | 09/14/2022 | 09/14/2022 | 0/1 | 這個題不難,但是如果數據足夠大,時間會溢出,所以要用 long | |
1283 | Core | Find the Smallest Divisor Given a Threshold | Binary Search | 09/14/2022 | 09/14/2022 | 1/1 | 和 875 一樣,説明白如果 div > maxVal, sum 都是 arr.length, 取最小;同樣注意溢出,用 long | |
69 | Important | Sqrt(x) | Binary Search | 09/14/2022 | 09/14/2022 | 0/1 | 二分注意 mid 溢出,(long)mid * mid <= x 或者 x / mid >= mid, 但是後者 mid 不能是 0;牛頓法\(x_{n + 1} = x_n - \frac{f(x_n)}{f'(x_n)}\) | |
LintCode586 | Important | Sqrt(x) II | Binary Search | 09/14/2022 | 09/14/2022 | 1/1 | 注意 x < 1 的話先算 1/x | |
912 | Required | Sort an Array | Sorting | 09/18/2022 | 09/18/2022 | 1/1 | merge sort/ quick sort | |
75 | Required | Sort Colors | Sorting, Two Pointers | 09/18/2022 | 09/18/2022 | 1/1 | 如果 p0 < p1,把 1 換出去了,還得換回來 | |
26 | Core | Remove Duplicates from Sorted Array | Two Pointers | 09/19/2022 | 09/19/2022 | 1/1 | 我的不是最優解,j 有重複的 | |
80 | Core | Remove Duplicates from Sorted Array II | Two Pointers | 09/19/2022 | 09/19/2022 | 0/1 | 這個可以推廣到最多保留 k 個重複 | |
88 | Core | Merge Sorted Array | Two Pointers | 09/19/2022 | 09/19/2022 | 1/1 | 就是反向 merge | |
283 | Core | Move Zeroes | Two Pointers | 09/19/2022 | 09/19/2022 | 0/1 | [0, lo - 1]是排好的,[lo, hi - 1]是 0,[hi, n - 1]是等待處理的 | |
215 | Core | Kth Largest Element in an Array | Two Pointers | 09/19/2022 | 09/19/2022 | 1/1 | 手寫排序,然後直接求即可 | |
347 | Core | Top K Frequent Elements | Heap/ Bucket Sort | 09/21/2022 | 09/21/2022 | 0/1 | 看到最大 k 个想到用 heap,或者桶排序 | |
349 | Core | Intersection of Two Arrays | HashTable/ Two pointers | 09/22/2022 | 09/22/2022 | 1/1 | 用集合注意加速,用排序注意去重 | |
350 | Core | Intersection of Two Arrays II | HashTable/ Two pointers | 09/23/2022 | 09/23/2022 | 1/1 | ||
845 | Core | Longest Mountain in Array | Dynamic programming | 09/23/2022 | 09/23/2022 | 0/1 | 动态规划,记录左边 l,右边 r, 如果 l > 0 && r > 0 => len = l + r + 1 | |
845 | Similar to 845 | Longest Continuous Increasing Subsequence | Dynamic programming | 09/23/2022 | 09/23/2022 | 1/1 | ||
42 | 11 | Core | Trapping Rain Water | Dynamic programming | 09/23/2022 | 09/23/2022 | 0/1 | 單純 dp,dp+雙指針加速 |
11 | Core | Container With Most Water | Two pointers | 09/24/2022 | 09/24/2022 | 0/1 | 雙指針更新面積即可,移動小的 height | |
43 | 415 | Core | Multiply Strings | String | 09/24/2022 | 09/24/2022 | 0/1 | 乘法,调用加法 |
415 | 2 43 989 | Core | Add Strings | String | 09/24/2022 | 09/24/2022 | 1/1 | 加法 |
969 | NA | Important | Pancake Sorting | Two Pointers/Sorting | 09/25/2022 | 09/25/2022 | 0/1 | 找最大,每次换到最后面去,然后考虑剩下的数组 |
21 | NA | Important | Pancake Sorting | Two Pointers/Sorting | 09/25/2022 | 09/25/2022 | 0/1 | 找最大,每次换到最后面去,然后考虑剩下的数组 |
86 | NA | Core | Partition List | Two Pointers | 09/25/2022 | 09/25/2022 | 1/1 | 注意c1.next = ge.next , c2.next = null |
141 | 142 202 | Core | Linked List Cycle | Hash Table/ Two Pointers | 09/25/2022 | 09/25/2022 | 0/1 | 注意寫法簡潔性 |
160 | 599 | Core | Intersection of Two Linked Lists | Hash Table/ Two Pointers | 09/25/2022 | 09/25/2022 | 1/1 | |
234 | 9 125 206 | Core | Palindrome Linked List | Recursion/ Two Pointers | 09/25/2022 | 09/25/2022 | 1/1 | |
328 | 725 | Core | Odd Even Linked List | LinkedList | 09/25/2022 | 09/25/2022 | 1/1 | |
142 | 141 287 | Important | Linked List Cycle II | Hash Table/Two Pointers | 09/25/2022 | 09/25/2022 | 0/1 | f = 2s, f = s + nb;之后 f = 0, s = nb,多走 a 就相遇了 |
287 | 41 136 268 645 | Important | Find the Duplicate Number | Two Pointers/Bit Manipulation | 09/26/2022 | 09/26/2022 | 0/1 | |
876 | NA | Important | Middle of the Linked List | Two Pointers/LinkedList | 09/26/2022 | 09/26/2022 | 1/1 | |
Lint391 | Lint821 Lint156 | Required | Number of Airplanes in the Sky | Sweep Line | 09/26/2022 | 09/26/2022 | 0/1 | 重叠區間問題標準做法: sweep line |
56 | 57 252 253 495 616 715 759 763 986 | Core | Merge Intervals | Array/Sorting | 09/26/2022 | 09/26/2022 | 1/1 | 掃描綫 Integer 過不來了,int 可以 |
57 | 56 715 | Core | Insert Interval | Array | 09/26/2022 | 09/26/2022 | 1/1 | 掃描綫 |
252 | 56 253 | Core | Meeting Rooms | Array/Sorting | 09/27/2022 | 09/27/2022 | 1/1 | 掃描綫,排序 |
253 | 56 252 452 1094] | Core | Meeting Rooms II | Sorting/Two Pointers/Prefix Sum | 09/27/2022 | 09/27/2022 | 1/1 | |
986 | 56 88 759 | Core | Interval List Intersections | Sorting/Two Pointers | 09/28/2022 | 09/28/2022 | 0/1 | |
5 | 214 226 [336] (#336) #516 647 345 | Core | Longest Palindromic Substring | String/ Dynamic Programming | 09/28/2022 | 09/28/2022 | 0/1 | |
345 | 344 1119 | Core | Reverse Vowels of a String | String/Two Pointers | 09/28/2022 | 09/28/2022 | 1/1 | 不要用 set.contains(ch),用 str.indexOf(ch) |
1119 | 345 | Similar to 345 | Remove Vowels from a String | String | 09/28/2022 | 09/28/2022 | 1/1 | |
344 | 345 541 | Similar to 345 | Reverse String | Recursion/Two Pointers | 09/28/2022 | 09/28/2022 | 1/1 | |
680 | 125 | Core | Valid Palindrome II | Greedy/Two Pointers | 09/28/2022 | 09/28/2022 | 0/1 | 暴力超时,思路是对的... |
125 | 680 234 | Important | Valid Palindrome | Greedy/Two Pointers | 09/28/2022 | 09/28/2022 | 1/1 | |
3 | 159 349 992 | Required | Longest Substring Without Repeating Characters | Hash Table/Sliding Window | 09/29/2022 | 09/29/2022 | 0/1 | 暴力超时; 学习滑动窗口模板 |
76 | 30 209 239 567 727 | Core | Minimum Window Substring | Hash Table/Sliding Window | 09/30/2022 | 09/30/2022 | 0/1 | 有重复所以用 need 和集合比; Integer 比较必须用 equals(),不能用等号 |
289 | 73 | Core | Game of Life | Matrix/Simulation | 10/01/2022 | 10/01/2022 | 1/1 | 優化空間 O(1)做法 |
209 | 76 325 718 | Core | Minimum Size Subarray Sum | Array/Sliding Window | 10/01/2022 | 10/01/2022 | 1/1 | |
239 | 76 155 159 265 | Core | Sliding Window Maximum | Heap/Monotonic Queue | 10/01/2022 | 10/01/2022 | 0/1 | PriorityQueue, 扔掉 window 左邊的;單調遞減隊列,後入隊的扔掉隊尾所有比它小的 |
713 | 152 325 560 1099 | Core | Subarray Product Less Than K | Sliding Window | 10/01/2022 | 10/01/2022 | 0/1 | 加入 hi 之后增加了hi-lo+1 个选择 |
395 | NA | Important | Longest Substring with At Least K Repeating Characters | HashTable | 10/02/2022 | 10/02/2022 | 0/1 | 递归:如果有不满足的就分界,否则返回全部长度 |
480 | 295 | Important | Sliding Window Median | Sliding Window/ Hash Table | 10/03/2022 | 10/03/2022 | 0/1 | 注意数据范围,先转double ;
用二分法注意如果删除了就停止 |
567 | 76 438 | Important | Permutation in String | HashTable/Sliding Window | 10/03/2022 | 10/03/2022 | 0/1 | 用 int[26]来比较是不是 permutation |
295 | 480 | Core | Find Median from Data Stream | Two Pointers/Heap | 10/03/2022 | 10/03/2022 | 1/1 | |
346 | NA | Important | Moving Average from Data Stream | Queue/Array | 10/03/2022 | 10/03/2022 | 1/1 | 注意 cnt 位置寫對 |
352 | 228 436 715 | Important | Data Stream as Disjoint Intervals | Ordered Set/Binary Search | 10/03/2022 | 10/03/2022 | 1/1 | |
703 | 215 | Important | Kth Largest Element in a Stream | BST/Heap | 10/03/2022 | 10/03/2022 | 1/1 | |
53 | 121 152 697 978 | Important | Maximum Subarray | Divide and Conquer/Dynamic Programming | 10/04/2022 | 10/04/2022 | 0/1 | 前项和:用滑动窗口来想,如果前项和<0,直接扔掉; |
238 | 42 152 265 | Important | Maximum Subarray | Prefix Sum | 10/06/2022 | 10/06/2022 | 1/1 | prefix 和 suffix;follow up 时候 suffix 只用一个就行了 |
303 | 304 307 325 | Important | Range Sum Query - Immutable | Prefix Sum | 10/06/2022 | 10/06/2022 | 1/1 | |
325 | 209 303 525 713 | Important | Maximum Size Subarray Sum Equals k | Prefix Sum | 10/07/2022 | 10/07/2022 | 0/1 | 最前面加上 1; prefix 可以不用数组,用一个 pointer |
528 | 398 710 497 | Important | Random Pick with Weight | Prefix Sum | 10/07/2022 | 10/07/2022 | 0/1 | |
560 | 1 523 713 724 974 | Important | Subarray Sum Equals K | Prefix Sum | 10/08/2022 | 10/08/2022 | 0/1 | map 保存出现次数,代表从 start 到 i 的总和为 k 的数组数量 |
1 | 15 18 167 170 560 653 1099 | Important | Two Sum | Hash Table | 10/09/2022 | 10/09/2022 | 1/1 | HashTable 先插入则要检查重复,后插入不需要检查重复 |
15 | 1 16 18 259 | Important | 3Sum | Sorting/ Two pointers | 10/10/2022 | 10/10/2022 | 0/1 | 排序,遇到重复的跳过 |
94 | 98 144 145 | Required | Binary Tree Inorder Traversal | Stack/BST | 11/07/2022 | 11/07/2022 | 1/1 | 注意 iterative approach |
144 | 94 589 255 | Required | Binary Tree Preorder Traversal | Stack/BST | 11/07/2022 | 11/07/2022 | 1/1 | 注意 iterative approach |
145 | 94 590 | Required | Binary Tree Postorder Traversal | Stack/BST | 11/07/2022 | 11/07/2022 | 1/1 | 注意 iterative approach |
105 | 94 590 | Required | Construct Binary Tree from Preorder and Inorder Traversal | Hash Table/BST | 11/07/2022 | 11/07/2022 | 1/1 | |
106 | 105 | Important | Construct Binary Tree from Inorder and Postorder Traversal | Hash Table/BST | 11/09/2022 | 11/09/2022 | 1/1 | |
889 | Important | Construct Binary Tree from Preorder and Postorder Traversal | Hash Table/BST | 11/09/2022 | 11/09/2022 | 1/1 | 這個問題答案不唯一 | |
173 | 94 251 281 284 285 | Required | Binary Search Tree Iterator | Stack/BST | 11/09/2022 | 11/09/2022 | 1/1 | |
230 | 94 671 | Required | Kth Smallest Element in a BST | Stack/BST | 11/09/2022 | 11/09/2022 | 1/1 | |
285 | 94 173 510 | Important | Inorder Successor in BST | BST | 11/09/2022 | 11/09/2022 | 1/1 | |
270 | 222 272 700 | Important | Closest Binary Search Tree Value | BST | 11/09/2022 | 11/09/2022 | 1/1 | 注意用prev優化, 或者直接二分法 |
272 | 94 270 | Important | Closest Binary Search Tree Value II | BST | 11/21/2022 | 11/21/2022 | 1/1 | |
510 | 285 | Important | Inorder Successor in BST II | BST | 11/21/2022 | 11/21/2022 | 1/1 | |
Lint-915 | Lint-67 Lint-86 Lint-448 | Important | Inorder Predecessor in BST | BST | 11/21/2022 | 11/21/2022 | 1/1 | |
98 | 94 501 | Core | Validate Binary Search Tree | BST | 11/21/2022 | 11/21/2022 | 0/1 | 注意递归的写法,注意数据范围所以使用long |
100 | Core | Same Tree | BST/BFS/DFS | 11/21/2022 | 11/21/2022 | 1/1 | ||
101 | Core | Symmetric Tree | BST/BFS/DFS | 11/21/2022 | 11/21/2022 | 1/1 | 注意base case别写复杂了 | |
110 | 104 | Core | Balanced Binary Tree | BST/BFS/DFS | 11/21/2022 | 11/21/2022 | 1/1 | |
111 | 102 104 | Core | Minimum Depth of Binary Tree | BST/BFS/DFS | 11/21/2022 | 11/21/2022 | 1/1 | |
104 | 110 111 559 | Important | Maximum Depth of Binary Tree | BST/BFS/DFS | 11/21/2022 | 11/21/2022 | 1/1 | |
333 | Important | Largest BST Subtree | BST/DFS/BFS | 11/21/2022 | 11/21/2022 | 0/1 | ||
112 | 113 124 129 437 666 | Core | Path Sum | BST/DFS/BFS | 11/21/2022 | 11/21/2022 | 0/1 | |
113 | 112 257 437 666 | Core | Path Sum II | BST/Backtracking | 11/21/2022 | 11/21/2022 | 0/1 | 注意对于每一个recursive call, current需要是独立的 |
124 | 112 129 666 687 | Core | Binary Tree Maximum Path Sum | BST/DP | 11/21/2022 | 11/21/2022 | 0/1 | 不要用global variable |
298 | 128 549 | Important | Binary Tree Longest Consecutive Sequence | BST/DP | 11/22/2022 | 11/22/2022 | 0/1 | 理解题意 |
549 | 298 | Important | Binary Tree Longest Consecutive Sequence II | BST/DP | 11/22/2022 | 11/22/2022 | 0/1 | 在递归目的和最优化目的不一致的时候用global variable |
236 | 235 1257 | Required | Lowest Common Ancestor of a Binary Tree | DFS/BT | 12/15/2022 | 12/15/2022 | 1/1 | postorder 更快 |
199 | 116 545 | Core | Binary Tree Right Side View | DFS/BFS | 12/16/2022 | 12/16/2022 | 1/1 | level order拿最后一个即可,注意root是null |
513 | Core | Find Bottom Left Tree Value | DFS/BFS | 12/16/2022 | 12/16/2022 | 1/1 | level order拿最后一行第一个即可 | |
331 | Core | Verify Preorder Serialization of a Binary Tree | DFS/BFS | 12/16/2022 | 12/16/2022 | 0/1 | directed graph indegree = outdegree, 注意"#"的特殊情况是true,以及不到最后indegree < outdegree | |
449 | 297 652 428 | Core | Serialize and Deserialize BST | DFS/BFS | 12/16/2022 | 12/16/2022 | 0/1 | 注意list的toString分隔符是", "(有一个空格),然后toString还包含了收尾的括号,需要去掉 |
114 | 430 | Important | Flatten Binary Tree to Linked List | DFS/BFS | 12/16/2022 | 12/16/2022 | 1/1 | preoder即可 |
442 | 448 | Core | Find All Duplicates in an Array | Array/Hash Table | 12/17/2022 | 12/17/2022 | 1/1 | 注意取abs |
48 | Core | Rotate Image | Array/Math | 12/18/2022 | 12/18/2022 | 0/1 | 顺时针90度=左右翻转+主对角线翻转(旋转270度是类似的逻辑) | |
54 | Core | Spiral Matrix | Matrix/Simulation | 12/18/2022 | 12/18/2022 | 1/1 | 控制左上右下然后模拟即可,注意size < n | |
73 | 289 | Core | Set Matrix Zeroes | Matrix/Hash Table | 12/18/2022 | 12/18/2022 | 1/1 | 可以用第一行/第一列当index空间复杂度是O(1) |
289 | 73 | Core | Game of Life | Matrix/Simulation | 12/18/2022 | 12/18/2022 | 1/1 | 模拟即可 |
6 | 73 | Core | Game of Life | String | 12/18/2022 | 12/18/2022 | 1/1 | 用flag和row控制上下即可,二维数组太容易错了 |
Solutions
704
1 | class Solution { |
34
1 | class Solution { |
702
1 | class Solution { |
153
1 | class Solution { |
154
1 | class Solution { |
278
1 | public class Solution { |
658
1 | public class Solution { |
33
1 | class Solution { |
81
1 | class Solution { |
4
1 | // 這是O(m + n) |
1 | class Solution { |
240
1 | // 這是O(m * log(n)) |
162
1 | // 這是O(n), 注意元素取值範圍,所以需要用long |
302
1 | // O(m * n)暴力計算 |
852
1 | class Solution { |
875
1 | class Solution { |
1283
1 | class Solution { |
69
1 | // 暴力解法 |
LintCode586
1 | public class Solution { |
912
1 | // merge sort |
75
1 | // brutal force |
26
1 | // 這個做法的j是有重複的,不是最優解 |
80
1 | class Solution { |
88
1 | class Solution { |
283
1 | class Solution { |
215
1 | class Solution { |
347
1 | // bucket sort, this one is O(n) |
349
1 | // time complexity O(m + n), space complexity O(m + n) |
350
1 | // time complexity: O(m + n), space complexity: O(m + n) |
845
1 | class Solution { |
674
1 | class Solution { |
42
1 | // time complexity: O(n), space complexity: O(n) |
11
1 | class Solution { |
43
1 | class Solution { |
415
1 | class Solution { |
969
1 | class Solution { |
21
1 | class Solution { |
86
1 | class Solution { |
141
1 | // time complexity O(n), space complexity O(1) |
160
1 | // time complexity O(n + m), space complexity O(1) |
234
1 | // time complexity O(n), space complexity O(n) |
328
1 | class Solution { |
142
1 | // time complexity O(n), space complexity O(n) |
287
1 | // brute force, time complexity O(n^2), space complexity O(1) |
876
1 | class Solution { |
Lint391
1 | // HashMap, time complexity O(n * max(interval)), space complexity O(n) |
56
1 | // time complexity O(nlogn), space complexity O(n) |
57
1 | // sweep line, time complexity O(nlogn), space complexity O(n) |
252
1 | // sweep line, time complexity O(nlogn), space complexity O(n) |
253
1 | // sorting + heap, time complexity O(nlogn), space complexity O(n) |
986
1 | class Solution { |
5
1 | class Solution { |
345
1 | class Solution { |
680
1 | class Solution { |
125
1 | class Solution { |
3
1 | class Solution { |
76
1 | class Solution { |
289
1 | // time complexity O(mn), space complexity O(mn) |
209
1 | class Solution { |
239
1 | // Heap: time complexity O(nlogn), space complexity O(k) |
713
1 | class Solution { |
395
1 | class Solution { |
480
1 | // Brute force: time complexity O(nklogk), space complexity O(nk) |
567
1 | // time complexity O(n), space complexity O(1) |
295
1 | // Heap: time complexity O(logn), space complexity O(n) |
346
1 | class MovingAverage { |
352
1 | class SummaryRanges { |
703
1 | class KthLargest { |
53
1 | // Prefix sum: time complexity O(n), space complexity O(1) |
238
1 | // Both prefix and suffix |
303
1 | class NumArray { |
325
1 | class Solution { |
325
1 | class Solution { |
560
1 | // Simulation: time complexity O(n^2), space complexity O(1) |
1</1>
1 | // Brute force: time complexity O(n^2), space complexity O(1) |
15
1 | // time complexity O(n^2), space complexity O(1) |
18
1 | class Solution { |
94
1 | // iterative approach |
144
1 | class Solution { |
145
1 | class Solution { |
105
1 | class Solution { |
106
1 | class Solution { |
889
1 | class Solution { |
173
1 | class BSTIterator { |
230
1 | class Solution { |
1 | class Solution { |
270
1 | // simple inorder traversal: O(n) time, O(n) space |
272
1 | // inorder traversal + linear search |
510
1 | class Solution { |
Lint-915
1 | public class Solution { |
98
1 | class Solution { |
100
1 | class Solution { |
101
1 | class Solution { |
110
1 | class Solution { |
111
1 | class Solution { |
104
1 | class Solution { |
333
1 | class Solution { |
112
1 | class Solution { |
113
1 | class Solution { |
124
1 | class Solution { |
298
1 | class Solution { |
549
1 | class Solution { |
236
1 | // simple approach, O(n^2) |
199
1 | class Solution { |
513
1 | class Solution { |
331
1 | class Solution { |
449
1 | // preOrder |
114
1 | class Solution { |
442
1 | class Solution { |
48
1 | class Solution { |
54
1 | class Solution { |
73
1 | // space complexity: O(m + n) |
289
1 | class Solution { |
6
1 | class Solution { |
Insertion mark
1119
1 | class Solution { |
344
1 | class Solution { |