| 1 |
Two Sum |
Two Sum |
O(n) |
O(n) |
| 2 |
Merge k Sorted Lists |
Merge k Sorted Lists |
O(n log n) |
O(1) |
| 3 |
Remove Duplicates from Sorted Array |
Remove Duplicates from Sorted Array |
|
|
| 4 |
Next Permutation |
Next Permutation |
O(n) |
O(1) |
| 5 |
Maximal Rectangle |
Maximal Rectangle |
O(n) |
O(n) |
| 6 |
Move Zeroes |
Move Zeroes |
|
|
| 7 |
Merge Intervals |
Merge Intervals |
O(n log n) |
O(n) |
| 8 |
Insert Interval |
Insert Interval |
O(n) |
O(n) |
| 9 |
Pascal's Triangle |
Pascal's Triangle |
O(n^2) |
O(n^2) |
| 10 |
Valid Parentheses |
Valid Parentheses |
O(n) |
O(n) |
| 11 |
Same Tree |
Same Tree |
O(log n) |
O(1) |
| 12 |
Plus One |
Plus One |
|
|
| 13 |
Bulls and Cows |
Bulls and Cows |
O(n) |
O(1) |
| 14 |
Evaluate Division |
Evaluate Division |
|
|
| 15 |
Decode String |
Decode String |
|
|
| 16 |
Word Break |
Word Break |
O(n^2) |
O(n) |
| 17 |
Number of Islands |
Number of Islands |
O(n^2) |
O(n^2) |
| 18 |
House Robber |
House Robber |
O(n) |
O(1) |
| 19 |
Longest Consecutive Sequence |
Longest Consecutive Sequence |
O(n log n) |
O(1) |
| 20 |
Spiral Matrix |
Spiral Matrix |
O(n^2) |
O(n^2) |
| 21 |
Product of Array Except Self |
Product of Array Except Self |
O(n) |
O(n) |
| 22 |
Clone Graph |
Clone Graph |
O(n) |
O(n) |
| 23 |
Kth Smallest Element in a BST |
Kth Smallest Element in a BST |
O(n) |
O(n) |
| 24 |
Longest Increasing Subsequence |
Longest Increasing Subsequence |
O(n^2) |
O(n) |
| 25 |
Pacific Atlantic Water Flow |
Pacific Atlantic Water Flow |
O(n^2) |
O(n^2) |
| 26 |
Implement Trie (Prefix Tree) |
Implement Trie (Prefix Tree) |
O(n) |
O(n) |
| 27 |
Word Search II |
Word Search II |
O(n^2) |
O(n^2) |
| 28 |
The Skyline Problem |
The Skyline Problem |
O(n log n) |
O(n) |
| 29 |
Pow(x, n) |
Pow(x, n) |
O(log n) |
O(log n) |
| 30 |
Longest Increasing Path in a Matrix |
Longest Increasing Path in a Matrix |
|
|
| 31 |
Find Median from Data Stream |
Find Median from Data Stream |
O(log n) |
O(n) |
| 32 |
Count of Smaller Numbers After Self |
Count of Smaller Numbers After Self |
|
|
| 33 |
Subarray Sum Equals K |
Subarray Sum Equals K |
|
|
| 34 |
Max Sum of Rectangle No Larger Than K |
[Max Sum of Rectangle No Larger Than K |
|
|
| 35 |
Split Array into Consecutive Subsequences |
Split Array into Consecutive Subsequences |
|
|
| 36 |
Split Array Largest Sum |
Split Array Largest Sum |
|
|
| 37 |
Target Sum |
Target Sum |
|
|
| 38 |
H-Index |
H-Index |
|
|
| 39 |
Regular Expression Matching |
Regular Expression Matching |
|
|
| 40 |
Basic Calculator |
Basic Calculator |
|
|
| 41 |
Letter Combinations of a Phone Number |
Letter Combinations of a Phone Number |
O(2^n) |
O(2^n) |
| 42 |
Wildcard Matching |
Wildvard Matching |
|
|
| 43 |
Add Strings |
Add Strings |
|
|
| 44 |
Generate Parentheses |
Generate Parentheses |
O(2^n) |
O(2^n) |
| 45 |
Word Ladder |
Word Ladder |
O(n^2) |
O(n^2) |
| 46 |
Shortest Palindrome |
Shortest Palindrome |
|
|
| 47 |
Remove Duplicate Letters |
Remove Duplicate Letters |
|
|
| 48 |
Valid Parenthesis String |
Valid Parenthesis String |
|
|
| 49 |
Game of Life |
Game of Life |
|
|
| 50 |
Trapping Rain Water |
Trapping Rain Water |
O(n^2) |
O(n) |
| 51 |
Word Break II |
Word Break II |
|
|
| 52 |
Next Greater Element II |
Next Greater Element II |
|
|
| 53 |
K Closest Points to Origin |
K Closest Points to Origin |
|
|
| 54 |
Expression Add Operators |
Expression Add Operators |
|
|
| 55 |
Search a 2D Matrix II |
Search a 2D Matrix II |
O(n) |
O(1) |
| 56 |
Combination Sum IV |
Combination Sum IV |
|
|
| 57 |
Min Stack |
Min Stack |
O(n) |
O(n) |
| 58 |
Fraction to Recurring Decimal |
Fraction to Recurring Decimal |
|
|
| 59 |
Binary Search Tree Iterator |
Binary Search Tree Iterator |
O(n) |
O(n) |
| 60 |
Perfect Squares |
Perfect Squares |
|
|
| 61 |
Find the Difference |
Find the Difference |
|
|
| 62 |
Daily Temperatures |
Daily Temperatures |
|
|
| 63 |
Isomorphic Strings |
Isomorphic Strings |
|
|
| 64 |
Max Consecutive Ones |
Max Concsecutive Ones |
|
|
| 65 |
Median of Two Sorted Arrays |
Median of Two Sorted Arrays |
O(n) |
O(n) |
| 66 |
Sliding Window Maximum |
Sliding Window Maximum |
O(n) |
O(n) |
| 67 |
First Unique Character in a String |
First Unique Character in a String |
|
|
| 68 |
Maximum Depth of Binary Tree |
Maximum Depth of Binary Tree |
O(n) |
O(n) |
| 69 |
Valid Anagram |
Valid Anagram |
O(n) |
O(n) |
| 70 |
Container With Most Water |
Container With Most Water |
O(n) |
O(1) |
| 71 |
Longest Substring Without Repeating Characters |
Longest Substring Without Repeating Characters |
O(n) |
O(n) |
| 72 |
Longest Palindromic Substring |
Longest Palindromic Substring |
O(n^2) |
O(1) |
| 73 |
Search in Rotated Sorted Array |
Search in Rotated Sorted Array |
O(log n) |
O(1) |
| 74 |
Word Search |
Word Search |
O(n^2) |
O(n) |
| 75 |
Coin Change |
Coin Change |
O(n^2) |
O(n) |
| 76 |
Maximum Subarray |
Maximum Subarray |
O(n) |
O(n) |
| 77 |
Palindrome Permutation |
Palindrome Permutation |
|
|
| 78 |
Lowest Common Ancestor of a Binary Tree |
Lowest Common Ancestor of a Binary Tree |
O(n) |
O(1) |
| 79 |
Kth Largest Element in an Array |
Kth Largest Element in an Array |
O(n log n) |
O(n) |
| 80 |
Best Time to Buy and Sell Stock IV |
Best Time to Buy and Sell Stock IV |
O(n^2) |
O(n^2) |
| 81 |
Best Time to Buy and Sell Stock II |
Best Time to Buy and Sell Stock II |
O(n) |
O(1) |
| 82 |
Two Sum II - Input array is sorted |
Two Sum II - Input Array Is Sorted |
O(n) |
O(n) |
| 83 |
Find Minimum in Rotated Sorted Array |
Find Minimum in Rotated Sorted Array |
O(log n) |
O(1) |
| 84 |
Maximum Product Subarray |
Maximum Product Subarray |
O(n) |
O(n) |
| 85 |
Linked List Cycle |
Linked List Cycle |
O(n) |
O(n) |
| 86 |
Pascal's Triangle |
Pascal's Triangle |
O(n^2) |
O(n^2) |
| 87 |
Valid Palindrome |
Valid Palindrome |
O(n) |
O(n) |
| 88 |
Reverse Linked List |
Reverse Linked List |
O(n) |
O(n) |
| 89 |
Decode Ways |
Decode Ways |
O(n) |
O(n) |
| 90 |
Merge Sorted Array |
Merge Sorted Array |
O(n) |
O(n) |
| 91 |
Subsets |
Subsets |
O(2^n) |
O(2^n) |
| 92 |
Set Matrix Zeroes |
Set Matrix Zeroes |
O(n^2) |
O(n) |
| 93 |
Climbing Stairs |
Climbing Stairs |
|
|
| 94 |
Minimum Path Sum |
Minmum Path Sum |
O(n^2) |
O(1) |
| 95 |
Unique Paths |
Unique Paths |
O(n^2) |
O(n^2) |
| 96 |
Unique Paths II |
Unique Paths II |
|
|
| 97 |
Jump Game |
Jump Game |
O(n^2) |
O(1) |
| 98 |
N-Queens |
N-Queens |
O(n!) |
O(n!) |
| 99 |
Group Anagrams |
Group Anagrams |
O(n) |
O(n) |
| 100 |
Permutations |
Permutations |
O(n!) |
O(n!) |
| 101 |
Count and Say |
Count and say |
O(2^n) |
O(n) |
| 102 |
Combination Sum |
Combination Sum |
O(2^n) |
O(n) |
| 103 |
Valid Sudoku |
Valid Sudoku |
O(n^2) |
O(n) |
| 104 |
Longest Valid Parentheses |
Longest Valid Parentheses |
O(n) |
O(n) |
| 105 |
Find the Index of the First Occurrence in a String |
Find the Index of the First Occurrence in a String |
|
|
| 106 |
3Sum |
3Sum |
O(n^2) |
O(n) |
| 107 |
3Sum Closest |
3Sum Closest |
O(n^2) |
O(1) |
| 108 |
Roman to Integer |
Roman to Integer |
O(n) |
O(1) |
| 109 |
String to Integer (atoi) |
String to Integer (atoi) |
O(n) |
O(1) |
| 110 |
Add Two Numbers |
Add Two Numbers |
O(n) |
O(n) |
| 111 |
Lowest Common Ancestor of a Binary Search Tree |
Lowest Common Ancestor of a Binary Search Tree |
O(n) |
O(1) |
| 112 |
Single Number |
Single Number |
|
|
| 113 |
Reverse Bits |
Reverse bits |
O(1) |
O(1) |
| 114 |
Happy Number |
Happy Number |
|
|
| 115 |
Contains Duplicate II |
Contains Duplicate II |
|
|
| 116 |
Contains Duplicate III |
Contains Duplicate III |
|
|
| 117 |
Basic Calculator II |
Basic Calculator II |
|
|
| 118 |
Alien Dictionary |
Alien Dictionary |
O(n log n) |
O(n) |
| 119 |
Reverse Nodes in k-Group |
Reverse Nodes in k-Group |
|
|
| 120 |
Sudoku Solver |
Sudoku Solver |
|
|
| 121 |
Multiply Strings |
Multiply Strings |
|
|
| 122 |
Sort Colors |
Sort Colors |
|
|
| 123 |
Course Schedule |
Course Schedule |
O(n) |
O(n) |
| 124 |
Top K Frequent Elements |
Top K Frequent Elements |
O(n) |
O(n) |
| 125 |
Perfect Rectangle |
Perfect Rectangle |
|
|
| 126 |
Jump Game II |
Jump Gmae II |
|
|
| 127 |
Course Schedule III |
Course Schedule III |
|
|
| 128 |
Permutations II |
Permutations II |
|
|
| 129 |
Find All Duplicates in an Array |
Find All Duplicates in an Array |
|
|
| 130 |
Excel Sheet Column Title |
Excel Sheet Column Title |
|
|
| 131 |
Reverse Words in a String |
Reverse Words in a String |
|
|
| 132 |
Strobogrammatic Number |
Strobogrammatic Number |
|
|
| 133 |
Search a 2D Matrix |
Search a 2D Matrix |
|
|
| 134 |
Check If N and Its Double Exist |
Check If N and Its Double Exist |
O(n) |
O(n) |
| 135 |
Longest Word in Dictionary |
Longest Word in Dictionary |
|
|
| 136 |
Determine if Two Events Have Conflict |
Determine if Two Events Have Conflict |
|
|
| 137 |
Largest Number |
Largest Number |
|
|
| 138 |
Invert Binary Tree |
Invert Binary Tree |
O(n) |
O(1) |
| 139 |
Guess Number Higher or Lower |
Guess Number Higher or Lower |
|
|
| 140 |
Number of Enclaves |
Number of Enclaves |
|
|
| 141 |
Walls And Gates |
Walls And Gates |
|
|
| 142 |
Island Perimeter |
Island Perimeter |
|
|
| 143 |
Flood fill |
Flood fill |
|
|
| 144 |
Find if Path Exists in Graph |
Find if Path Exists in Graph |
|
|
| 145 |
Tree Diameter |
Tree Diameter |
O(n) |
O(n) |
| 146 |
Symmetric Tree |
Symmetric Tree |
O(n) |
O(n) |
| 147 |
Binary Tree Vertical Order Traversal |
Binary Tree Vertical Order Traversal |
O(n) |
O(n) |
| 148 |
Minimum Obstacle Removal to Reach Corner |
Minimum Obstacle Removal to Reach Corner |
O(n^2) |
O(n) |
| 149 |
Number of Islands |
Number of Islands |
O(n^2) |
O(n^2) |
| 150 |
Cheapest Flights Within K Stops |
Cheapest Flights Within K Stops |
O(n^2) |
O(n) |
| 151 |
Jump Game III |
Jump Game III |
O(n) |
O(n) |
| 152 |
Kill process |
Kill process |
O(n) |
O(n) |
| 153 |
Surrounded Regions |
Surrounded Regions |
O(n^2) |
O(1) |
| 154 |
Brace Expansion |
Brace Expansion |
O(2^n) |
O(2^n) |
| 155 |
Count Complete Tree Nodes |
Count Complete Tree Nodes |
O(log n) |
O(log n) |
| 156 |
4Sum |
4Sum |
O(n^2) |
O(n) |
| 157 |
Binary Search |
Binary Search |
O(log n) |
O(1) |
| 158 |
Minimum Number of Operations to Convert Time |
Minimum Number of Operations to Convert Time |
O(n) |
O(1) |
| 159 |
Destination City |
Destination City |
O(n) |
O(n) |