1. Two Sum |
hash |
17 ms |
48.16% |
4.4 MB |
39.11% |
2. Add Two Numbers |
list |
22 ms |
32.84% |
4.6 MB |
47.70% |
3. Longest Substring Without Repeating Characters |
string |
8 ms |
82.87% |
3.2 MB |
49.07% |
4. Median of Two Sorted Arrays |
bs |
18 ms |
82.18% |
5 MB |
97.04% |
5. Longest Palindromic Substring |
string |
0 ms |
100.00% |
2.4 MB |
88.40% |
8. String to Integer (atoi) |
bit |
3 ms |
71.06% |
2.2 MB |
86.06% |
11. Container With Most Water |
tp |
86 ms |
87.43% |
8.7 MB |
81.87% |
13. Roman to Integer |
hash |
32 ms 26 ms |
6.18% 12.54% |
2.9 MB 2.9 MB |
28.45% 84.08% |
14. Longest Common Prefix |
string |
0 ms |
100.00% |
2.4 MB |
54.69% |
15. 3Sum |
sorting |
28 ms |
98.04% |
7.2 MB |
84.91% |
17. Letter Combinations of a Phone Number |
hash |
0 ms |
100.00% |
2.1 MB |
17.09% |
19. Remove Nth Node from End of List |
tp |
0 ms |
100.00% |
2.1 MB |
87.27% |
20. Valid Parentheses |
stack |
3 ms |
38.04% |
2.1 MB |
45.97% |
21. Merge Two Sorted Lists |
list |
0 ms |
100.00% |
2.6 MB |
50.16% |
22. Generate Parentheses |
dp |
2 ms |
68.65% |
2.7 MB |
72.79% |
23. Merge K Sorted Lists |
heap |
9 ms |
90.73% |
5.3 MB |
95.09% |
24. Swap Nodes in Pairs |
list |
0 ms |
100.00% |
2.1 MB |
78.46% |
25. Reverse Nodes in k-Group |
list |
6 ms |
76.96% |
3.8 MB |
11.16% |
31. Next permutation |
array |
9 ms |
15.94% |
2.5 MB |
8.70% |
32. Longest Valid Parentheses |
stack |
8 ms |
26.36% |
3.5 MB |
54.09% |
33. Search in Rotated Sorted Array |
bs |
4 ms |
65.36% |
2.6 MB |
72.33% |
34. Find First and Last Position of Element fo Sorted Array |
bs |
5 ms |
94.67% |
3.9 MB |
99.89% |
35. Search Insert Position |
bs |
0 ms |
100.00% |
3 MB |
9.01% |
39. Combination Sum |
array |
8 ms |
42.42% |
3.2 MB |
60.32% |
41. First Missing Positive |
array |
69 ms |
59.50% |
9 MB |
32.25% |
41. First Missing Positive |
hash |
63 ms |
64.50% |
8.3 MB |
57.75% |
42. Trapping Rain Water |
tp |
21 ms |
61.96% |
5.4 MB |
74.08% |
43. Multiply Strings |
bit |
4 ms |
70.45% |
2.3 MB |
76.89% |
45. Jump Game II |
dp |
22 ms |
83.19% |
6 MB |
92.02% |
46. Permutations |
dp |
0 ms |
100.00% |
2.4 MB |
99.62% |
48. Rotate Image |
matrix |
4 ms |
32.05% |
2.3 MB |
67.11% |
49. Group Anagrams |
hash |
17 ms |
98.89% |
7.4 MB |
94.57% |
51. N-Queens |
array |
12 ms |
39.61% |
3.5 MB |
38.16% |
51. N-Queens |
backtracking |
7 ms |
76.33% |
3.1 MB |
94.20% |
53. Maximum Subarray |
tp |
236 ms |
14.86% |
9.3 MB |
70.21% |
54. Spiral Matrix |
matrix |
2 ms 2 ms |
42.16% 42.01% |
2 MB 2 MB |
9.95% 74.49% |
55. Jump Game |
dp |
63 ms 78 ms |
91.15% 85.44% |
6.9 MB 7.4 MB |
87.59% 65.80% |
56. Merge Intervals |
sorting |
50 ms |
29.74% |
7.4 MB |
13.83% |
62. Unique Paths |
dp |
0 ms |
100.00% |
2.1 MB |
58.64% |
64. Minimum Path Sum |
dp |
15 ms |
59.29% |
3.9 MB |
91.74% |
69. Sqrt(x) |
bit |
16 ms |
30.32% |
2.1 MB |
23.07% |
70. Climbing Stairs |
dp |
0 ms |
100.00% |
2 MB |
39.58% |
72. Edit Distance |
dp |
5 ms |
60.69% |
5.6 MB |
42.77% |
73. Set Matrix Zeroes |
hash |
17 ms |
76.88% |
6.3 MB |
97.58% |
74. Search a 2D Matrix |
bs |
4 ms |
69.72% |
2.6 MB |
100.00% |
75. Sort Colors |
tp |
5 ms |
10.42% |
2.1 MB |
71.07% |
76. Minimum Window Substring |
hash |
17 ms |
78.20% |
2.9 MB |
24.94% |
78. Subsets |
dp |
4 ms 4 ms |
23.23% 23.23% |
2.3 MB 2.3 MB |
80.65% 80.65% |
79. Word Search |
graph |
293 ms 930 ms |
30.51% 16.12% |
2.2 MB 2.1 MB |
26.86% 31.89% |
82. Remove Duplicates from Sorted List II |
tp |
2 ms |
96.02% |
2.9 MB |
87.17% |
83. Remove Duplicates from Sorted List |
list |
3 ms |
88.19% |
3.2 MB |
41.45% |
84. Largest Rectangle in Histogram |
array |
790 ms |
6.34% |
8.6 MB |
93.66% |
88. Merge Sorted Array |
array |
4 ms |
38.68% |
2.3 MB |
19.30% |
92. Reverse Linked List II |
tp |
0 ms |
100.00% |
2.1 MB |
16.51% |
93. Restore IP Addresses |
backtracking |
2 ms |
42.57% |
2 MB |
86.14% |
94. Binary Tree Inorder Traversal |
tree |
2 ms |
43.97% |
1.9 MB |
89.17% |
96. Unique Binary Search Trees |
dp |
0 ms |
100.00% |
2 MB |
33.33% |
98. Validate Binary Search Tree |
tree |
15 ms |
20.57% |
5.3 MB |
34.22% |
101. Symmetric Tree |
tree |
4 ms |
61.49% |
2.9 MB |
84.46% |
102. Binary Tree Level Order Traversal |
tree |
6 ms 3 ms |
26.25% 67.41% |
3.1 MB 2.8 MB |
23.49% 53.22% |
103. Binary Tree Zigzag Level Order Traversal |
tp |
3 ms |
44.27% |
2.6 MB |
64.89% |
104. Maximum Depth of Binary Tree |
tree |
12 ms 3 ms |
17.00% 91.65% |
4.3 MB 4.4 MB |
13.27% 13.27% |
105. Construct Binary Tree from Preorder and Inorder Traversal |
tree |
7 ms |
69.10% |
4.2 MB |
74.62% |
108. Convert Sorted Array to Binary Search Tree |
tree |
5 ms |
35.96% |
3.6 MB |
8.94% |
110. Balanced Binary Tree |
tree |
9 ms |
73.93% |
5.9 MB |
10.52% |
112. Path Sum |
tree |
8 ms |
68.29% |
4.6 MB |
92.45% |
113. Path Sum II |
tree |
9 ms |
47.64% |
4.4 MB |
89.27% |
114. Flatten Binary Tree to Linked List |
tree |
8 ms |
16.43% |
2.9 MB |
33.57% |
121. Best Time to Buy and Sell Stock |
tp |
274 ms 237 ms |
39.40% 61.98% |
9 MB 8.8 MB |
38.81% 66.22% |
122. Best Time to Buy and Sell Stock II |
dp |
6 ms |
80.27% |
3.2 MB |
11.72% |
124. Binary Tree Maximum Path Sum |
tree |
301 ms |
5.30% |
7.4 MB |
82.07% |
124. Binary Tree Maximum Path Sum |
recursion |
31 ms |
56.84% |
7.4 MB |
94.37% |
128. Longest Consecutive Sequence |
dp |
152 ms |
62.71% |
11.4 MB |
37.10% |
129. Sum Root to Leaf numbers |
recursion |
0 ms |
100.00% |
2.2 MB |
77.70% |
131. Palindrome Partitioning |
dp |
540 ms |
32.49% |
22.4 MB |
36.29% |
136. Single Number |
bit |
25 ms |
74.01% |
6.6 MB |
35.49% |
138. Copy List with Random Pointer |
hash |
0 ms |
100.00% |
3.7 MB |
13.85% |
139. Word Break |
hash |
4 ms |
39.92% |
2.2 MB |
64.97% |
141. Linked List Cycle |
hash |
20 ms |
22.46% |
6.4 MB |
17.18% |
141. Linked List Cycle |
tp |
9 ms |
87.26% |
4.4 MB |
31.25% |
142. Linked List Cycle II |
hash |
8 ms |
76.58% |
5.2 MB |
20.99% |
143. Reorder List |
tp |
7 ms |
97.64% |
5.3 MB |
100.00% |
144. Binary Tree Preorder Traversal |
tree |
0 ms |
100.00% |
2 MB |
43.41% |
146. LRU Cache |
hash |
1053 ms |
28.52% |
73.6 MB |
75.90% |
148. Sort List |
sorting |
78 ms |
77.78% |
9.8 MB |
12.65% |
151. Reverse Words in a String |
string |
2 ms |
70.99% |
3.1 MB |
65.27% |
152. Maximum Product Subarray |
dp |
13 ms |
36.62% |
3.4 MB |
79.11% |
153. Find Minimum in Rotated Sorted Array |
bs |
4 ms |
59.71% |
2.5 MB |
80.00% |
155. Min Stack |
stack |
33 ms |
51.83% |
9 MB |
29.25% |
160. Intersection of Two Linked Lists |
hash |
85 ms |
18.85% |
8.1 MB |
13.13% |
160. Intersection of Two Linked Lists |
tp |
31 ms |
95.31% |
6.8 MB |
92.46% |
162. Find Peak Element |
bs |
0 ms |
100.00% |
2.8 MB |
71.48% |
165. Compare Version Numbers |
concurrency |
2 ms |
31.58% |
2 MB |
80.70% |
169. Majority Element |
hash |
46 ms |
16.36% |
6.4 MB |
10.34% |
169. Majority Element |
array |
25 ms |
73.30% |
6.3 MB |
34.77% |
179. Largest Number |
sorting |
0 ms |
100.00% |
2.3 MB |
98.66% |
189. Rotate Array |
tp |
64 ms |
55.97% |
8.8 MB |
34.95% |
189. Rotate Array |
array |
69 ms |
43.14% |
8.6 MB |
50.10% |
198. House Robber |
dp |
0 ms |
100.00% |
2.1 MB |
42.51% |
199. Binary Tree Right Side View |
tree |
0 ms |
100.00% |
2.2 MB |
99.45% |
200. Number of Islands |
graph |
2 ms |
93.67% |
3.9 MB |
80.96% |
206. Reverse Linked List |
list |
5 ms |
36.47% |
2.6 MB |
79.13% |
207. Course Schedule |
recursion |
114 ms |
5.15% |
6.6 MB |
51.83% |
207. Course Schedule |
graph |
9 ms |
96.70% |
6 MB |
92.67% |
208. Implement Trie (Prefix Tree) |
hash |
57 ms |
94.05% |
18.6 MB |
27.50% |
209. Minimum Size Subarray Sum |
window |
41 ms |
80.32% |
8.4 MB |
26.60% |
215. Kth Largest Element in an Array |
sorting |
158 ms |
57.96% |
9.1 MB |
57.06% |
221. Maximal Square |
graph |
10 ms |
79.78% |
6.7 MB |
89.89% |
224. Basic Calculator |
stack |
4 ms |
81.40% |
2.9 MB |
100.00% |
226. Invert Binary Tree |
tree |
2 ms |
48.55% |
2.1 MB |
100.00% |
227. Basic Calculator II |
stack |
0 ms |
100.00% |
2.7 MB |
100.00% |
230. Kth Smallest Element in BST |
tree |
4 ms |
98.74% |
6.3 MB |
97.85% |
234. Palindrome Linked List |
list |
357 ms |
27.75% |
12.7 MB |
17.25% |
234. Palindrome Linked List |
tp |
209 ms |
82.14% |
9.2 MB |
95.69% |
236. Lowest Common Ancestor of a Binary Tree |
tree |
41 ms |
7.72% |
7.8 MB |
33.86% |
236. Lowest Common Ancestor of a Binary Tree |
recursion |
19 ms |
65.19% |
7.1 MB |
78.69% |
238. Product of Array Except Self |
tp |
39 ms |
77.70% |
9.1 MB |
6.14% |
239. Sliding Window Maximum |
window |
469 ms |
62.85% |
10 MB |
80.41% |
240. Search a 2D Matrix II |
matrix |
17 ms |
97.98% |
7 MB |
79.76% |
283. Move Zeroes |
tp |
39 ms |
67.76% |
7.5 MB |
16.58% |
287. Find the Duplicate Number |
hash |
100 ms |
88.22% |
8.9 MB |
62.36% |
295. Find Median from Data Stream |
sorting |
642 ms |
65.93% |
20.1 MB |
84.96% |
297. Serialize and Deserialize Binary Tree |
tree |
13 ms |
90.5% |
7.2 MB |
72.73% |
300. Longest Increasing Subsequence |
dp |
76 ms |
40.00% |
3.7 MB |
39.57% |
322. Coin Change |
dp |
478 ms |
10.37% |
7.1 MB |
48.69% |
347. Top K Frequent Elements |
hash |
16 ms |
82.86% |
5.5 MB |
85.29% |
378. Kth Smallest Element in a Sorted Matrix |
bs |
42 ms |
77.42% |
7.6 MB |
45.97% |
383. Ransom Note |
hash |
37 ms |
20.93% |
3.9 MB |
82.91% |
394. Decode String |
stack |
3 ms |
26.65% |
2 MB |
91.85% |
402. Remove K Digits |
stack |
4 ms |
85.53% |
4.1 MB |
90.79% |
412. Fizz Buzz |
string |
12 ms |
23.25% |
3.6 MB |
65.38% |
415. Add Strings |
string |
4 ms |
71.28% |
2.5 MB |
93.62% |
416. Partition Equal Subset Sum |
dp |
315 ms |
37.62% |
6.5 MB |
74.92% |
437. Path Sum III |
tree |
35 ms |
27.68% |
10.4 MB |
7.59% |
438. Find All Anagrams in a String |
window |
7 ms |
90.63% |
5.2 MB |
56.25% |
460. LFU Cache |
heap |
682 ms |
90.00% |
85.9 MB |
42.50% |
468. Validate IP Address |
string |
0 ms |
100.00% |
2 MB |
83.33% |
470. Implement Rand10() using Rand7() |
bit |
37 ms |
30.00% |
5.7 MB |
30.00% |
470. Implement Rand10() using Rand7() |
rejection sampling |
15 ms |
100.00% |
5.6 MB |
100.00% |
498. Diagonal Traverse |
matrix |
48 ms |
52.17% |
7.2 MB |
53.91% |
543. Diameter of Binary Tree |
recursion |
10 ms |
42.77% |
4.4 MB |
76.63% |
560. Subarray Sum Equals K |
hash |
1728 ms |
11.27% |
7 MB |
79.72% |
662. Maximum Width of Binary Tree |
tree |
3 ms |
91.49% |
4.7 MB |
42.55 |
647. Palindromic Substrings |
dp |
90 ms |
11.90% |
1.9 MB |
94.64% |
695. Max Area of Island |
graph |
10 ms |
94.97% |
4.9 MB |
97.04% |
704. Binary Search |
bs |
24 ms |
99.68% |
6.7 MB |
75.19% |
718. Maximum Length of Repeated Subarray |
dp |
72 ms |
64.41% |
19.1 MB |
43.83% |
739. Daily Temperatures |
dp |
372 ms |
29.05% |
10.1 MB |
34.76% |
763. Partition Labels |
tp |
5 ms |
39.57% |
2.2 MB |
66.19% |
876. Middle of the Linked List |
tp |
3 ms |
36.50% |
2 MB |
15.37% |
912. Sort an Array |
sorting |
860 ms |
37.28% |
11.9 MB |
32.73% |
912. Sort an Array |
heap |
119 ms |
96.82% |
7.5 MB |
96.82% |
958. Check Completeness of a Binary Tree |
tree |
0 ms |
100.00% |
3.1 MB |
56.41% |
994. Rotting Oranges |
graph |
6 ms |
60.00% |
3.1 MB |
24.35% |
1143. Longest Common Subsequence |
dp |
7 ms |
70.03% |
11 MB |
36.50% |
1337. The K Weakest Rows in a Matrix |
matrix |
21 ms |
63.44% |
4.9 MB |
80.65% |
1342. Number of Steps to Reduce a Number to Zero |
bit |
0 ms |
100.00% |
1.9 MB |
13.84% |
1672. Richest Customer Wealth |
graph |
2 ms |
95.32% |
3 MB |
100.00% |