Divide and Conquer: 95, 96
# | 題目 | 原始碼 | 難度 | 速度 | 記憶體 |
---|---|---|---|---|---|
0 | Template | cpp | Easy | ms | MB |
1 | Two Sum | cpp | Easy | 9 ms | 10.6 MB |
2 | Add Two Numbers | cpp | Medium | 28 ms | 10.5 MB |
3 | Longest Substring Without Repeating Characters | cpp | Easy | 12 ms | 9.2 MB |
7 | Reverse Integer | cpp | Easy | 4 ms | 8.2 MB |
8 | String to Integer (atoi) | cpp | Medium | 20 ms | 5.3 MB |
9 | Palindrome Number | cpp | Easy | 12 ms | 8.2 MB |
11 | Container With Most Water | cpp | Medium | 28 ms | 9.8 MB |
12 | Integer to Roman | cpp | Medium | 68 ms | 12.2 MB |
13 | Roman to Integer | cpp | Easy | 12 ms | 8.5 MB |
14 | Longest Common Prefix | cpp | Easy | 8 ms | 1.4 MB |
15 | 3Sum | cpp | Medium | 104 ms | 14.9 MB |
16 | 3Sum Closest | cpp | Medium | 16 ms | 8.7 MB |
17 | Letter Combinations of a Phone Number | cpp | Medium | 4 ms | 8.7 MB |
18 | 4Sum | cpp | Medium | 116 ms | 9.2 MB |
19 | Remove Nth Node From End of List | cpp | Medium | 4 ms | 8.7 MB |
20 | Valid Parentheses | cpp | Easy | 8 ms | 8.3 MB |
21 | Merge Two Sorted Lists | cpp | Medium | 8 ms | 9.1 MB |
22 | Generate Parentheses | cpp | Medium | 8 ms | 17.2 MB |
23 | Merge k Sorted Lists | cpp | Hard | 28 ms | 11.8 MB |
24 | Swap Nodes in Pairs | cpp | Medium | 0 ms | 6.8 MB |
25 | Reverse Nodes in k-Group | cpp | Hard | 28 ms | 9.1 MB |
26 | Remove Duplicates from Sorted Array | cpp | Easy | 24 ms | 10 MB |
27 | Remove Element | cpp | Easy | 4 ms | 8.7 MB |
28 | Implement strStr() | cpp | Easy | 1364 ms | 9.2 MB |
31 | Next Permutation | cpp | Medium | 8 ms | 8.6 MB |
33 | Search in Rotated Sorted Array | cpp | Medium | 4 ms | 6.7 MB |
34 | Find First and Last Position of Element in Sorted Array | cpp | Medium | 8 ms | 8 MB |
35 | Search Insert Position | cpp | Easy | 4 ms | 7 MB |
38 | Count and Say | cpp | Easy | 4 ms | 56.8 MB |
36 | Valid Sudoku | cpp | Medium | 12 ms | 7.2 MB |
39 | Combination Sum | cpp | Medium | 16 ms | 11.2 MB |
40 | Combination Sum II | cpp | Medium | 12 ms | 7 MB |
41 | First Missing Positive | cpp | Hard | 0 ms | 6.6 MB |
42 | Trapping Rain Water | cpp | Hard | 4 ms | 6.8 MB |
43 | Multiply Strings | cpp | Medium | 16 ms | 6.8 MB |
45 | Jump Game II | cpp | Hard | 12 ms | 7.8 MB |
46 | Permutations | cpp | Medium | 8 ms | 7.3 MB |
47 | Permutations II | cpp | Medium | 44 ms | 8.2 MB |
48 | Rotate Image | cpp | Medium | 12 ms | 7 MB |
49 | Group Anagrams | cpp | Medium | 40 ms | 18.1 MB |
50 | Pow(x, n) | cpp | Medium | 12 ms | N/A |
53 | Maximum Subarray | cpp | Easy | 4 ms | 9.3 MB |
54 | Spiral Matrix | cpp | Medium | 0 ms | 6.3 MB |
55 | Jump Game | cpp | Medium | 8 ms | 7.9 MB |
56 | Merge Intervals | cpp | Medium | 24 ms | 9.9 MB |
57 | Insert Interval | cpp | Medium | 16 ms | 17.5 MB |
58 | Length of Last Word | cpp | Easy | 0 ms | 6.5 MB |
59 | Spiral Matrix II | cpp | Medium | 0 ms | 6.5 MB |
62 | Unique Paths | cpp | Medium | 4 ms | 8.9 MB |
63 | Unique Paths II | cpp | Medium | 4 ms | 9.3 MB |
64 | Minimum Path Sum | cpp | Medium | 8 ms | 11 MB |
66 | Plus One | cpp | Easy | 4 ms | 8.6 MB |
67 | Add Binary | cpp | Easy | 8 ms | 9.7 MB |
69 | Sqrt(x) | cpp | Easy | 25 ms | N/A |
70 | Climbing Stairs | cpp | Easy | 4 ms | 8.2 MB |
72 | Edit Distance | cpp | Easy | 16 ms | 11.4 MB |
73 | Set Matrix Zeroes | cpp | Medium | 48 ms | 11.5 MB |
74 | Search a 2D Matrix | cpp | Medium | 4 ms | 9.6 MB |
75 | Sort Colors | cpp | Medium | 4 ms | 8.7 MB |
76 | Minimum Window Substring | cpp | Hard | 52 ms | 16.3 MB |
77 | Combinations | cpp | Medium | 732 ms | 165.6 MB |
78 | Subsets | cpp | Medium | 8 ms | 9.8 MB |
79 | Word Search | cpp | Medium | 352 ms | 156.7 MB |
81 | Search in Rotated Sorted Array II | cpp | Medium | 4 ms | 6.8 MB |
83 | Remove Duplicates from Sorted List | cpp | Easy | 8 ms | 7.7 MB |
84 | Largest Rectangle in Histogram | cpp | Hard | 24 ms | 10.9 MB |
86 | Partition List | cpp | Medium | 8 ms | 10.4 MB |
88 | Merge Sorted Array | cpp | Easy | 4 ms | 8.7 MB |
91 | Decode Ways | cpp | Medium | 0 ms | 6.5 MB |
92 | Reverse Linked List II | cpp | Medium | 4 ms | 8.8 MB |
93 | Restore IP Addresses | cpp | Medium | 0 ms | 6.5 MB |
94 | Binary Tree Inorder Traversal | cpp | Medium | 4 ms | 9.6 MB |
96 | Unique Binary Search Trees | cpp | Medium | 0 ms | 6.3 MB |
98 | Validate Binary Search Tree | cpp | Easy | 20 ms | 20.7 MB |
99 | Recover Binary Search Tree | cpp | Hard | 24 ms | 23.8 MB |
100 | Same Tree | cpp | Easy | 0 ms | 7.6 MB |
101 | Symmetric Tree | cpp | Easy | 8 ms | 14.8 MB |
102 | Binary Tree Level Order Traversal | cpp | Medium | 16 ms | 15.2 MB |
103 | Binary Tree Zigzag Level Order Traversal | cpp | Medium | 4 ms | 13.2 MB |
104 | Maximum Depth of Binary Tree | cpp | Easy | 8 ms | 17.1 MB |
107 | Binary Tree Level Order Traversal II | cpp | Easy | 4 ms | 11.8 MB |
108 | Convert Sorted Array to Binary Search Tree | cpp | Easy | 24 ms | 21.8 MB |
110 | Balanced Binary Tree | cpp | Easy | 16 ms | 14.4 MB |
111 | Minimum Depth of Binary Tree | cpp | Easy | 12 ms | 17.6 MB |
112 | Path Sum | cpp | Easy | 16 ms | 19.7 MB |
113 | Path Sum II | cpp | Medium | 16 ms | 19.7 MB |
118 | Pascal's Triangle | cpp | Easy | 0 ms | 6.6 MB |
119 | Pascal's Triangle II | cpp | Easy | 4 ms | 6.5 MB |
120 | Triangle | cpp | Medium | 4 ms | 7.5 MS |
121 | Best Time to Buy and Sell Stock | cpp | Easy | 4 ms | 7.3 MB |
122 | Best Time to Buy and Sell Stock II | cpp | Easy | 4 ms | 7.4 MB |
125 | Valid Palindrome | cpp | Easy | 8 ms | 7.8 MB |
128 | Longest Consecutive Sequence | cpp | Hard | 16 ms | 8 MB |
129 | Sum Root to Leaf Numbers | cpp | Medium | 0 ms | 9.1 MB |
131 | Palindrome Partitioning | cpp | Medium | 88 ms | 23.9 MB |
133 | Clone Graph | cpp | Medium | 12 ms | 9 MB |
136 | Single Number | cpp | Easy | 16 ms | 9.6 MB |
141 | Linked List Cycle | cpp | Easy | 36 ms | 10 MB |
144 | Binary Tree Preorder Traversal | cpp | Medium | 12 ms | 9.4 MB |
146 | LRU Cache | cpp | Medium | 80 ms | 40 MB |
147 | Insertion Sort List | cpp | Medium | 32 ms | 9.7 MB |
155 | Min Stack | cpp | Easy | 40 ms | 14.7 MB |
160 | Intersection of Two Linked Lists | cpp | Easy | 108 ms | 21 MB |
167 | Two Sum II - Input array is sorted | cpp | Easy | 6 ms | N/A |
168 | Excel Sheet Column Title | cpp | Easy | 0 ms | 5.9 MB |
169 | Majority Element | cpp | Easy | 28 ms | 9 MB |
171 | Excel Sheet Column Number | cpp | Easy | 0 ms | 5.9 MB |
172 | Factorial Trailing Zeroes | cpp | Easy | 0 ms | 6.1 MB |
179 | Largest Number | cpp | Medium | 12 ms | 11 MB |
189 | Rotate Array | cpp | Easy | 16 ms | 7.2 MB |
190 | Reverse Bits | cpp | Easy | 0 ms | 5.9 MB |
191 | Number of 1 Bits | cpp | Easy | 0 ms | 6.2 MB |
195 | Univalued Binary Tree | cpp | Easy | 4 ms | 10.7 MB |
198 | House Robber | cpp | Easy | 0 ms | 6.3 MB |
200 | Number of Islands | cpp | Medium | 12 ms | 10 MB |
202 | Happy Number | cpp | Easy | 8 ms | 8.5 MB |
203 | Remove Linked List Elements | cpp | Easy | 32 ms | 10.8 MB |
204 | Count Primes | cpp | Easy | 532 ms | 9.1 MB |
205 | Isomorphic Strings | cpp | Easy | 8 ms | 7 MB |
206 | Reverse Linked List | cpp | Easy | 8 ms | 9.4 MB |
207 | Course Schedule | cpp | Medium | 20 ms | 13 MB |
208 | Implement Trie (Prefix Tree) | cpp | Medium | 72 ms | 26.2 MB |
215 | Kth Largest Element in an Array | cpp | Medium | 16 ms | 9.2 MB |
217 | Contains Duplicate | cpp | Easy | 48 ms | 13.6 MB |
219 | Contains Duplicate II | cpp | Easy | 40 ms | 12.6 MB |
221 | Maximal Square | cpp | Medium | 28 ms | 12 MB |
225 | Implement Stack using Queues | cpp | Easy | 0 ms | 6.6 MB |
226 | Invert Binary Tree | cpp | Easy | 4 ms | 9.1 MB |
231 | Power of Two | cpp | Easy | 0 ms | 5.9 MB |
232 | Implement Queue using Stacks | Easy | 0 ms | 6.8 MB | |
234 | Palindrome Linked List | cpp | Easy | 28 ms | 11.4 MB |
235 | Lowest Common Ancestor of a Binary Search Tree | cpp | Easy | 44 ms | 23.2 MB |
237 | Delete Node in a Linked List | cpp | Easy | 16 ms | 8 MB |
238 | Product of Array Except Self | cpp | Medium | 20 ms | 25 MB |
242 | Valid Anagram | cpp | Easy | 8 ms | 7.5 MB |
251 | Flatten 2D Vector.cpp | cpp | Medium | 16 ms | 19.6 MB |
253 | Meeting Rooms II | cpp | Medium | 12 ms | 11.8 MB |
263 | Ugly Number | cpp | Easy | 4 ms | 8.1 MB |
264 | Ugly Number II | cpp | Medium | 12 ms | 14.9 MB |
313 | Super Ugly Number | cpp | Medium | 72 ms | 10 MB |
326 | Power of Three | cpp | Easy | 36 MB | 6.2 ms |
332 | Coin Change | cpp | Medium | 88 MB | 14.4 ms |
359 | Logger Rate Limiter | cpp | Easy | 64 MB | 32.5 ms |
380 | Insert Delete GetRandom | cpp | Medium | 68 ms | 22.6 MB |
386 | Lexicographical Numbers | cpp | Medium | 68 ms | 11.8 MB |
392 | Is Subsequence | cpp | Medium | 64 ms | 17 MB |
445 | Add Two Numbers II | cpp | Medium | 20 ms | 13.7 MB |
454 | 4Sum II | cpp | Medium | 148 ms | 28.6 MB |
455 | Assign Cookies | cpp | Easy | 44 ms | 10.4 MB |
461 | Hamming Distance | cpp | Easy | 4 ms | 8.1 MB |
509 | Fibonacci Number | cpp | Easy | 12 ms | 5.7 MB |
515 | Find Largest Value in Each Tree Row | cpp | Medium | 24 ms | 23.5 MB |
523 | Continuous Subarray Sum | cpp | Medium | 152 ms | 96.6 MB |
532 | K-diff Pairs in an Array | cpp | Medium | 60 ms | 42 MB |
542 | 01 Matrix | cpp | Medium | 196 ms | 21.1 MB |
547 | Number of Provinces | cpp | Medium | 12 ms | 14.2 MB |
560 | Subarray Sum Equals K | cpp | Medium | 80 ms | 42 MB |
650 | 2 Keys Keyboard | cpp | Medium | 4 ms | 8.2 MB |
679 | 24 Game | cpp | Hard | 36 ms | 15.7 MB |
690 | Employee Importance | cpp | Easy | 28 ms | 14.1 MB |
695 | Max Area of Island | cpp | Medium | 12 ms | 23.1 MB |
725 | Split Linked List in Parts | cpp | Medium | 8 ms | 8.9 MB |
729 | My Calendar | cpp | Medium | 68 ms | 38.9 MB |
739 | Daily Temperatures | cpp | Medium | 144 ms | 42.7 MB |
746 | Min Cost Climbing Stairs | cpp | Easy | 8 ms | 13.8 MB |
767 | 767. Reorganize String | cpp | Medium | 0 ms | 8.6 MB |
771 | Jewels and Stones | cpp | Easy | 4 ms | 8.1 MB |
792 | Number of Matching Subsequences | cpp | Medium | 168 ms | 39.5 MB |
797 | All Paths From Source to Target | cpp | Medium | 84 ms | 11.4 MB |
876 | Middle of the Linked List | cpp | Easy | 0 ms | 6.5 MB |
939 | Minimum Area Rectangle | cpp | Medium | 720 ms | 19.6 MB |
951 | Flip Equivalent Binary Trees | cpp | Medium | 4 ms | 12.2 MB |
973 | K Closest Points to Origin | cpp | Medium | 212 ms | 73.7 MB |
980 | Unique Paths III | cpp | Hard | 4 ms | 8.8 MB |
983 | Minimum Cost For Tickets | cpp | Medium | 4 ms | 6.7 MB |
1010 | Pairs of Songs With Total Durations Divisible by 60 | cpp | Medium | 28 ms | 23.2 MB |
1019 | Next Greater Node In Linked List | cpp | Medium | 436 ms | 83.8 MB |
1025 | Divisor Game | cpp | Easy | 0 ms | 5.8 MB |
1041 | 1041. Robot Bounded In Circle | cpp | Medium | 0 ms | 6.2 MB |
1108 | Defanging an IP Address | cpp | Easy | 0 ms | 5.8 MB |
1119 | Remove Vowels from a String | cpp | Easy | 0 ms | 6.3 MB |
1219 | Path with Maximum Gold | cpp | Medium | 40 ms | 7.4 MB |
1249 | Minimum Remove to Make Valid Parentheses | cpp | Medium | 20 ms | 9.8 MB |
1254 | Number of Closed Islands | cpp | Medium | 12 ms | 9.5 MB |
1265 | Print Immutable Linked List in Reverse | cp | Easy | 4 ms | 6.6 MB |
1277 | Count Square Submatrices with All Ones | cpp | Medium | 88 ms | 23.6 MB |
1290 | Convert Binary Number in a Linked List to Integer cpp | Easy | 0 ms | 8.2 MB | |
1302 | Deepest Leaves Sum | cpp | Medium | 44 ms | 39.3 MB |
1306 | Jump Game III | cpp | Medium | 52 ms | 10.9 MB |
1314 | Matrix Block Sum | cpp | Medium | 16 ms | 9.6 MB |
1357 | Apply Discount Every n Orders | cpp | Medium | 208 ms | 120.6 MB |
1396 | Design Underground System | cpp | Medium | 128 ms | 57.4 MB |
1465 | Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | cpp | Medium | 68 ms | 32.1 MB |
1474 | Delete N Nodes After M Nodes of a Linked List | cpp | Easy | 40 ms | 15.8 MB |
1480 | Running Sum of 1d Array | cpp | Easy | 4 ms | 8.5 MB |
1481 | Least Number of Unique Integers after K Removals | cpp | Medium | 160 ms | 62.6 MB |
1525 | Number of Good Ways to Split a String | cpp | Medium | 48 ms | 11.3 MB |
1570 | Dot Product of Two Sparse Vectors | cpp | Medium | 180 ms | 174.3 MB |
1602 | Find Nearest Right Node in Binary Tree | cpp | Medium | 144 ms | 87.2 MB |
1641 | Count Sorted Vowel Strings | cpp | Medium | 0 ms | 5.9 MB |
1669 | Merge In Between Linked Lists | cpp | Medium | 504 ms | 95.1 MB |
1672 | Richest Customer Wealth | cpp | Easy | 8 ms | 7.8 MB |
1702 | Maximum Binary String After Change | cpp | Medium | 156 ms | 40.4 MB |
1721 | Swapping Nodes in a Linked List | cpp | Medium | 768 ms | 180.1 MB |