- Problem Solving.
- Math. Complexity. O-notation.
- Logic and Bits.
- Lecture Notes in Colab
- Further Resources:
- Data Structures Overview
- Recursion.
- Lecture Notes in Colab
- Further Resources:
- Manuel Rubio-Sánchez, Introduction to Recursive Programming
- Linear Algorithms on Arrays 1
- Linear Algorithms on Arrays 2
- Monotonic Stack
- Binary Tree.
5.5. Backtracking
- Lecture Notes in Colab (in progress)
- Stack. Queue. Deque.
- Sorting: Simple Sorting Algorithms, Stability.
- Sorting: Merge Sort and Quick Sort.
- Heap. Heap Sort. Priority Queue.
- Divide and Conquer. Binary Search.
- Lecture Notes in Colab
- Further Resources:
- Search Tree. Balancing.
- Strings.
- Introduction to Graphs. BFS. DFS.
- Dynamic Programming
- Hash Maps.
- Lecture Notes in Colab
- Further Resources:
-
Skip Lists
-
Treap
Common Sense
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Ugly Number | 2. | Reverse Integer | 3. | Palindrome Number | 4. | Pow(x, n) | 5. | Water and Jug Problem |
| 6. | Nth Digit | 7. | Random Pick with Weight | 8. | Bulb Switcher | 9. | Bulb Switcher II | 10. |
Arrays. Running Sum
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Minimum Value to Get Positive Step by Step Sum | 2. | Best Time to Buy and Sell Stock II | 3. | Range Addition II | 4. | Product of Array Except Self | 5. | N-Repeated Element in Size 2N Array |
| 6. | Majority Element | 7. | Rotate Image | 8. | Find the Duplicate Number | 9. | Partition Array into Disjoint Intervals | 10. | Valid Mountain Array |
| 11. | Defuse the Bomb | 12. | Most Visited Sector in a Circular Track | 13. | Next Permutation | 14. | Permutations II | 15. | Monotone Increasing Digits |
| 16. | Increasing Triplet Subsequence | 17. | Longest Substring with At Least K Repeating Characters | 18. | 19. | 20. |
Arrays. Two Pointers.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Arithmetic Slices | 2. | Detect Pattern of Length M Repeated K or More Times | 3. | Longest Continuous Increasing Subsequence | 4. | Trapping Rain Water | 5. | Maximum Distance Between a Pair of Values |
| 6. | Replace the Substring for Balanced String | 7. | Sort Colors | 8. | Number of Substrings With Only 1s | 9. | Maximum Distance Between a Pair of Values | 10. | Longest Substring Without Repeating Characters |
| 11. | Minimum Size Subarray Sum | 12. | Rotate Array | 13. | Reverse String | 14. | Sort Array By Parity | 15. | Move Zeroes |
| 16. | Sum of Square Numbers | 17. | Permutation in String | 18. | Shortest Subarray to be Removed to Make Array Sorted | 19. | 20. |
Lists. Difference Between Iterative and Recursive Approaches.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Delete Node in a Linked List | 2. | Linked List Cycle | 3. | Intersection of Two Linked Lists | 4. | Palindrome Linked List | 5. | Reverse Linked List |
| 6. | Odd Even Linked List | 7. | Remove Duplicates from Sorted List II | 8. | Merge In Between Linked Lists | 9. | Reverse Linked List II | 10. | Split Linked List in Parts |
| 11. | Swap Nodes in Pairs | 12. | Design Linked List | 13. | 14. | 15. |
Logic and Bits
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Single Number | 2. | Power of Two | 3. | Number of 1 Bits | 4. | Determine Color of a Chessboard Square | 5. | Power of Three |
| 6. | Power of Four | 7. | Adding Two Negabinary Numbers | 8. | Find Elements in a Contaminated Binary Tree | 9. | Gray Code | 10. | Circular Permutation in Binary Representation |
| 11. | Elimination Game | 12. | 13. | 14. | 15. |
Binary Tree
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Diameter of Binary Tree | 2. | Sum Root to Leaf Numbers | 3. | Sum of Left Leaves | 4. | Maximum Depth of Binary Tree | 5. | Minimum Depth of Binary Tree |
| 6. | Binary Tree Tilt | 7. | Invert Binary Tree | 8. | Univalued Binary Tree | 9. | Same Tree | 10. | Symmetric Tree |
| 11. | Path In Zigzag Labelled Binary Tree | 12. | Find a Corresponding Node of a Binary Tree in a Clone of That Tree | 13. | Minimum Time to Collect All Apples in a Tree | 14. | The k-th Lexicographical String of All Happy Strings of Length n | 15. |
Backtracking
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Combinations | 2. | Combination Sum | 3. | Combination Sum II | 4. | Combination Sum III | 5. | Fair Distribution of Cookies |
| 6. | Palindrome Partitioning | 7. | 8. | 9. | 10. | ||||
| 11. | 12. | 13. | 14. | 15. |
Stack. Queue. Deque.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Remove All Adjacent Duplicates in String II | 2. | Binary Tree Inorder Traversal | 3. | Valid Parentheses | 4. | Implement Stack using Queues | 5. | Implement Queue using Stacks |
| 6. | Next Greater Element II | 7. | Maximum Width Ramp | 8. | Find the Most Competitive Subsequence | 9. | Evaluate Reverse Polish Notation | 10. | Asteroid Collision |
| 11. | Next Greater Node In Linked List | 12. | Minimum Number of Swaps to Make the String Balanced | 13. | Removing Stars From a String | 14. | Remove K Digits | 15. |
Sorting: Simple Sorting Algorithms, Stability.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Insertion Sort List | 2. | How Many Numbers Are Smaller Than the Current Number | 3. | Sort Colors | 4. | Custom Sort String | 5. | Sort Array By Parity |
| 6. | Two City Scheduling | 7. | Partition List | 8. | Queue Reconstruction by Height | 9. | Sort List | 10. | Find Closest Number to Zero |
| 11. | Largest Number | 12. | 13. | 14. | 15. |
Sorting: Merge Sort and Quick Sort.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Insertion Sort List | 2. | How Many Numbers Are Smaller Than the Current Number | 3. | Sort Colors | 4. | Custom Sort String | 5. | Sort Array By Parity |
| 6. | Two City Scheduling | 7. | Partition List | 8. | Partition Array According to Given Pivot | 9. | 10. |
Heap. Heap Sort. Priority Queue.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Remove Stones to Minimize the Total | 2. | Seat Reservation Manager | 3. | Find Median from Data Stream | 4. | Furthest Building You Can Reach | 5. | Total Cost to Hire K Workers |
| 6. | 7. | 8. | 9. | 10. | |||||
| 11. | 12. | 13. | 14. | 15. |
Divide and Conquer. Binary Search.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Beautiful Array | 2. | Count Complete Tree Nodes | 3. | Median of Two Sorted Arrays | 4. | Search in Rotated Sorted Array | 5. | Two Sum |
| 6. | Single Element in a Sorted Array | 7. | Peak Index in a Mountain Array | 8. | Find Peak Element | 9. | Find Minimum in Rotated Sorted Array | 10. | Minimum Limit of Balls in a Bag |
| 11. | Sqrt(x) | 12. | Koko Eating Bananas | 13. | Capacity To Ship Packages Within D Days | 14. | Maximum Subarray | 15. | Maximum Value at a Given Index in a Bounded Array |
Search Tree. Balancing.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Search in a Binary Search Tree | 2. | Lowest Common Ancestor of a Binary Search Tree | 3. | Trim a Binary Search Tree | 4. | Range Sum of BST | 5. | Insert into a Binary Search Tree |
| 6. | Balance a Binary Search Tree | 7. | Increasing Order Search Tree | 8. | Minimum Distance Between BST Nodes | 9. | Kth Smallest Element in a BST | 10. | Convert Sorted Array to Binary Search Tree |
| 11. | Validate Binary Search Tree | 12. | 13. | 14. | 15. |
Strings.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Remove All Occurrences of a Substring | 2. | Reverse String | 3. | Reverse String II | 4. | Reverse Vowels of a String | 5. | Maximum Nesting Depth of the Parentheses |
| 6. | 1-bit and 2-bit Characters | 7. | Maximum Score After Splitting a String | 8. | Long Pressed Name | 9. | Is Subsequence | 10. | Add Strings |
| 11. | Ransom Note | 12. | Maximum Number of Balloons | 13. | Largest Substring Between Two Equal Characters | 14. | Consecutive Characters | 15. | Count and Say |
| 16. | Shortest Distance to a Character | 17. | 18. | 19. | 20. |
Introduction to Graphs. BFS. DFS.
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | All Nodes Distance K in Binary Tree | 2. | Distribute Coins in Binary Tree | 3. | Minimum Number of Vertices to Reach All Nodes | 4. | Shortest Path in Binary Matrix | 5. | Open the Lock |
| 6. | Number of Closed Islands | 7. | Number of Enclaves | 8. | Clone Graph | 9. | 10. | ||
| 11. | 12. | 13. | 14. | 15. |
Dynamic Programming
Hash Maps
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Design HashMap | 2. | LRU Cache | 3. | Top K Frequent Elements | 4. | Number of Good Pairs | 5. | Maximum Erasure Value |
| 6. | Apply Discount Every n Orders | 7. | Longest Arithmetic Subsequence of Given Difference | 8. | Count Nice Pairs in an Array | 9. | Restore the Array From Adjacent Pairs | 10. | Remove Zero Sum Consecutive Nodes from Linked List |
| 11. | Count Number of Pairs With Absolute Difference K | 12. | Number of Pairs of Interchangeable Rectangles | 13. | Check if All Characters Have Equal Number of Occurrences | 14. | 15. |
Union-Find
| # | Problem | # | Problem | # | Problem | # | Problem | # | Problem |
|---|---|---|---|---|---|---|---|---|---|
| 1. | Redundant Connection | 2. | 3. | 4. | 5. | ||||
| 6. | 7. | 8. | 9. | 10. | |||||
| 11. | 12. | 13. | 14. | 15. |
. Fenwick Tree (Binary Index Tree).
. Combinatorial Problems.
. FFT.
. Union-Find
. Arrays
. Lists. Difference Between Iterative and Recursive Approaches.
