- Includes all Grind 169 questions.
- Includes Extra questions I like.
- TODO: Top Interview questions.
| Name | Complexity | Examples | Notes |
|---|---|---|---|
| Constant | O(1) |
Basic arithmetics | |
| Logarithmic | O(log n) |
Binary search, balanced tree height | |
| Linear | O(n) |
Linear search, non-comparison sort | |
| Linearithmic | O(n log n) |
Comparison sort | also known as Quasilinear |
| Quadratic | O(n^2) |
||
| Cubic | O(n^3) |
||
| Exponential | O(2^n) |
Backtracking (all subsets) | |
| Factorial | O(n!) |
Backtracking (all permutations) |
- Two Sum | π©
- Best Time to Buy and Sell Stock | π©
- Majority Element | π©
- Majority Element II | π¨ | Extra
- Meeting Rooms | π©
- Meeting Rooms II | π¨
- Contains Duplicate | π©
- Move Zeroes | π©
- Squares of a Sorted Array | π©
- Insert Interval | π¨
- 3Sum | π¨
- Product of Array Except Self | π¨
- Merge Intervals | π¨
- Sort Colors | π¨
- Container With Most Water | π¨
- Gas Station | π¨
- Longest Consecutive Sequence | π¨
- Rotate Array | π¨
- Contiguous Array | π¨
- Subarray Sum Equals K | π¨
- 3Sum Closest | π¨
- Non-overlapping Intervals | π¨
- Employee Free Time | π₯
- Sliding Window Maximum | π₯
- Flood Fill | π©
- 01 Matrix | π¨
- Clone Graph | π¨
- Course Schedule | π¨
- Number of Islands | π¨
- Rotting Oranges | π¨
- Accounts Merge | π¨
- Word Search | π¨
- Minimum Height Trees | π¨
- Pacific Atlantic Water Flow | π¨
- Shortest Path to Get Food | π¨
- Graph Valid Tree | π¨
- Course Schedule II | π¨
- Number of Connected Components in an Undirected Graph | π¨
- Minimum Knight Moves | π¨
- Cheapest Flights Within K Stops | π¨
- Word Ladder | π₯
- Longest Increasing Path in a Matrix | π₯
- Word Search II | π₯
- Alien Dictionary | π₯
- Bus Routes | π₯
- Invert Binary Tree | π©
- Balanced Binary Tree | π©
- Diameter of Binary Tree | π©
- Maximum Depth of Binary Tree | π©
- Same Tree | π©
- Symmetric Tree | π©
- Subtree of Another Tree | π©
- Binary Tree Level Order Traversal | π¨
- Lowest Common Ancestor of a Binary Tree | π¨
- Binary Tree Right Side View | π¨
- Construct Binary Tree from Preorder and Inorder Traversal | π¨
- Construct Binary Tree from Inorder and Postorder Traversal | π¨ | Extra
- Construct Binary Tree from Preorder and Postorder Traversal
- Path Sum | π© | Extra
- Path Sum II | π¨
- Path Sum III | π¨
- Maximum Width of Binary Tree | π¨
- Binary Tree Zigzag Level Order Traversal | π¨
- All Nodes Distance K in Binary Tree | π¨
- Serialize and Deserialize Binary Tree | π₯
- Binary Tree Maximum Path Sum | π₯
- Step-By-Step Directions From a Binary Tree Node to Another | π¨ | Extra
- Lowest Common Ancestor of a Binary Search Tree | π©
- Convert Sorted Array to Binary Search Tree | π©
- Validate Binary Search Tree | π¨
- Kth Smallest Element in a BST | π¨
- Inorder Successor in BST | π¨
- Binary Search | π©
- First Bad Version | π©
- Search in Rotated Sorted Array | π¨
- Time Based Key-Value Store | π¨
- Search a 2D Matrix | π¨
- Find Minimum in Rotated Sorted Array | π¨
- Maximum Profit in Job Scheduling | π₯
- Median of Two Sorted Arrays | π₯
- Valid Palindrome | π©
- Valid Anagram | π©
- Longest Palindrome | π©
- Longest Common Prefix | π©
- Verifying an Alien Dictionary | π© | Extra
- Longest Substring Without Repeating Characters | π¨
- String to Integer (atoi) | π¨
- Longest Palindromic Substring | π¨
- Find All Anagrams in a String | π¨
- Group Anagrams | π¨
- Longest Repeating Character Replacement | π¨
- Largest Number | π¨
- Encode and Decode Strings | π¨
- Minimum Window Substring | π₯
- Palindrome Pairs | π₯
- Implement Trie (Prefix Tree) | π¨
- Word Break | π¨
- Design Add and Search Words Data Structure | π¨
- Design In-Memory File System | π₯
- Spiral Matrix | π¨
- Valid Sudoku | π¨
- Rotate Image | π¨
- Set Matrix Zeroes | π¨
- Sudoku Solver | π₯
- Roman to Integer | π©
- Palindrome Number | π©
- Random Pick with Weight | π¨
- Pow(x, n) | π¨
- Reverse Integer | π¨
- Add Binary | π©
- Counting Bits | π©
- Number of 1 Bits | π©
- Single Number | π©
- Missing Number | π©
- Reverse Bits | π©
- Find the Duplicate Number | π¨
- Valid Parentheses | π©
- Remove Invalid Parentheses | π₯ | Extra
- Implement Queue using Stacks | π©
- Backspace String Compare | π©
- Min Stack | π¨
- Daily Temperatures | π¨
- Decode String | π¨
- Evaluate Reverse Polish Notation | π¨
- Asteroid Collision | π¨
- Trapping Rain Water | π₯
- Basic Calculator | π₯
- Basic Calculator II | π¨
- Largest Rectangle in Histogram | π₯
- Maximum Frequency Stack | π₯
- Longest Valid Parentheses | π₯
- K Closest Points to Origin | π¨
- Task Scheduler | π¨
- Top K Frequent Words | π¨
- Find K Closest Elements | π¨
- Kth Largest Element in an Array | π¨
- Find Median from Data Stream | π₯
- Merge k Sorted Lists | π₯
- Smallest Range Covering Elements from K Lists | π₯
- Any distinct subset of size K from a set of N elements is a valid combination.
- Any distinct element arrangement of size N from a set with N elements is a valid permutation.
- Permutations | π¨
- Permutations II | π¨ | Extra
- Next Permutation | π¨
- Permutation Sequence | π₯ | Extra
- Subsets | π¨
- Subsets II | π¨ | Extra
- Combination Sum | π¨
- Combination Sum II | π¨ | Extra
- Combination Sum III | π¨ | Extra
- Combination Sum IIV | π¨ | Extra
- Combinations | π¨ | Extra
- Letter Case Permutation | π¨ | Extra
- Letter Combinations of a Phone Number | π¨
- Generate Parentheses | π¨
- N-Queens | π₯
- N-Queens II | π₯ | Extra
- Merge Two Sorted Lists | π©
- Linked List Cycle | π©
- Linked List Cycle II | π¨ | Extra
- Reverse Linked List | π©
- Middle of the Linked List | π©
- Palindrome Linked List | π©
- LRU Cache | π¨
- Remove Nth Node From End of List | π¨
- Swap Nodes in Pairs | π¨
- Odd Even Linked List | π¨
- Add Two Numbers | π¨
- Sort List | π¨
- Reorder List | π¨
- Rotate List | π¨
- Reverse Nodes in k-Group | π₯
- Design Hit Counter | π¨
- Ransom Note | π©
- Remove Letter To Equalize Frequency | π© | Extra
- Insert Delete GetRandom O(1) | π¨
- First Missing Positive | π₯
- Minimum Deletions to Make Character Frequencies Unique | π¨ | Extra
- Climbing Stairs | π©
- Maximum Subarray | π¨
- Coin Change | π¨
- Partition Equal Subset Sum | π¨
- Unique Paths | π¨
- House Robber | π¨
- Maximum Product Subarray | π¨
- Longest Increasing Subsequence | π¨
- Jump Game | π¨
- Maximal Square | π¨
- Decode Ways | π¨
- Combination Sum IV | π¨