Looking for a more bite-sized approach to improve your programming skills over time? This problem set is for you!
These problems will introduce you to some of the most foundational Data Structure & Algorithm concepts. Please, complete them in the order they are provided, as the concepts build on each other.
The sequence of these questions and their solutions are sourced from NeetCode: https://neetcode.io/roadmap. He is an EXCELLENT resource for studying the most common DS&A concepts that appear in software development interviews. Here is his Youtube channel
Working through these problems and understanding the patterns used to solve them WILL make you a better programmer.
The problems will give you the tools to more efficiently load, process, store, and manipulate data in any program, in any language you write code in.
Don't try to do this list all at once. Take the time to dig into each question.
Take the time to study the solutions to the problem, and understand the DS&A concept involved in the solution. These are challenging problems and concepts, so completing 1 problem a day is more than enough to help you grow as a programmer.
When taking on these problems, you should try to solve them on your own for 15-20 minutes, but no longer than that. Not knowing the answer is fine. You want to ensure you give yourself time to work your brain to solve it, but not waste time if you just don't have the knowledge.
After 15-20 minutes, you can then view other peoples solutions in the "Solutions" tab in the LeetCode window. When you view the solution, you should then take the time (at least 25 minutes at a time) to understand how the solution works, adding it to your own code window and changing pieces of it to help understand what each part does. Then, take a 5 minute break. After that break, come back and try to solve the problem on your own again with no help.
You may use any programming language you want to solve these problems.
As you work through the problem set, store a solution file for each problem in the solutions
directory.
Sequence | Difficulty | Problem Name | Data Stucture/Algorithm Type | Link to Leetcode Problem | Link to NeetCode Solution |
---|---|---|---|---|---|
1 | Easy | Contains Duplicate | Arrays & Hashing | Link To LeetCode Problem | Link To NeetCode Solution |
2 | Easy | Valid Anagram | Arrays & Hashing | Link To LeetCode Problem | Link To NeetCode Solution |
3 | Easy | Two Sum | Arrays & Hashing | Link To LeetCode Problem | Link To NeetCode Solution |
4 | Medium | Group Anagrams | Arrays & Hashing | Link To LeetCode Problem | Link To NeetCode Solution |
5 | Medium | Top K Frequent Elements | Arrays & Hashing | Link To LeetCode Problem | Link To NeetCode Solution |
6 | Medium | Product of Array Except Self | Arrays & Hashing | Link To LeetCode Problem | Link To NeetCode Solution |
7 | Medium | Valid Sudoku | Arrays & Hashing | Link To LeetCode Problem | Link To NeetCode Solution |
8 | Medium | Longest Consecutive Sequence | Arrays & Hashing | Link To LeetCode Problem | Link To NeetCode Solution |
9 | Easy | Valid Palindrome | Two Pointers | Link To LeetCode Problem | Link To NeetCode Solution |
10 | Medium | Two Sum II Input Array Is Sorted | Two Pointers | Link To LeetCode Problem | Link To NeetCode Solution |
11 | Medium | 3Sum | Two Pointers | Link To LeetCode Problem | Link To NeetCode Solution |
12 | Medium | Container With Most Water | Two Pointers | Link To LeetCode Problem | Link To NeetCode Solution |
13 | Easy | Valid Parentheses | Stack | Link To LeetCode Problem | Link To NeetCode Solution |
14 | Medium | Min Stack | Stack | Link To LeetCode Problem | Link To NeetCode Solution |
15 | Medium | Evaluate Reverse Polish Notation | Stack | Link To LeetCode Problem | Link To NeetCode Solution |
16 | Medium | Generate Parentheses | Stack | Link To LeetCode Problem | Link To NeetCode Solution |
17 | Medium | Daily Temperatures | Stack | Link To LeetCode Problem | Link To NeetCode Solution |
18 | Medium | Car Fleet | Stack | Link To LeetCode Problem | Link To NeetCode Solution |
19 | Easy | Binary Search | Binary Search | Link To LeetCode Problem | Link To NeetCode Solution |
20 | Medium | Search a 2D matrix | Binary Search | Link To LeetCode Problem | Link To NeetCode Solution |
21 | Medium | Koko Eating Bananas | Binary Search | Link To LeetCode Problem | Link To NeetCode Solution |
22 | Medium | Find Minimum in Rotated Sorted Array | Binary Search | Link To LeetCode Problem | Link To NeetCode Solution |
23 | Medium | Search in Rotated Sorted Array | Binary Search | Link To LeetCode Problem | Link To NeetCode Solution |
24 | Medium | Time Based Key Value Store | Binary Search | Link To LeetCode Problem | Link To NeetCode Solution |
25 | Easy | Best Time to Buy And Sell Stock | Sliding Window | Link To LeetCode Problem | Link To NeetCode Solution |
26 | Medium | Longest Substring Without Repeating Characters | Sliding Window | Link To LeetCode Problem | Link To NeetCode Solution |
27 | Medium | Longest Repeating Character Replacement | Sliding Window | Link To LeetCode Problem | Link To NeetCode Solution |
28 | Medium | Permutation In String | Sliding Window | Link To LeetCode Problem | Link To NeetCode Solution |
29 | Easy | Reverse Linked List | Linked List | Link To LeetCode Problem | Link To NeetCode Solution |
30 | Easy | Merge Two Sorted Lists | Linked List | Link To LeetCode Problem | Link To NeetCode Solution |
31 | Easy | Linked List Cycle | Linked List | Link To LeetCode Problem | Link To NeetCode Solution |
32 | Medium | Reorder List | Linked List | Link To LeetCode Problem | Link To NeetCode Solution |
33 | Medium | Remove Nth Node From End of List | Linked List | Link To LeetCode Problem | Link To NeetCode Solution |
34 | Medium | Copy List With Random Pointer | Linked List | Link To LeetCode Problem | Link To NeetCode Solution |
35 | Medium | Add Two Numbers | Linked List | Link To LeetCode Problem | Link To NeetCode Solution |
36 | Medium | Find The Duplicate Number | Linked List | Link To LeetCode Problem | Link To NeetCode Solution |
37 | Medium | LRU Cache | Linked List | Link To LeetCode Problem | Link To NeetCode Solution |
38 | Easy | Invert Binary Tree | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
39 | Easy | Maximum Depth of Binary Tree | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
40 | Easy | Diameter of Binary Tree | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
41 | Easy | Balanced Binary Tree | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
42 | Easy | Same Tree | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
43 | Easy | Subtree of Another Tree | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
44 | Medium | Lowest Common Ancestor of a Binary Search Tree | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
45 | Medium | Binary Tree Level Order Traversal | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
46 | Medium | Binary Tree Right Side View | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
47 | Medium | Count Good Nodes In Binary Tree | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
48 | Medium | Validate Binary Search Tree | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
49 | Medium | Kth Smallest Element In a Bst | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
50 | Medium | Construct Binary Tree From Preorder And Inorder Traversal | Trees | Link To LeetCode Problem | Link To NeetCode Solution |
51 | Medium | Implement Trie Prefix Tree | Tries | Link To LeetCode Problem | Link To NeetCode Solution |
52 | Medium | Design Add And Search Words Data Structure | Tries | Link To LeetCode Problem | Link To NeetCode Solution |
53 | Easy | Kth Largest Element In a Stream | Heap / Priority Queue | Link To LeetCode Problem | Link To NeetCode Solution |
54 | Easy | Last Stone Weight | Heap / Priority Queue | Link To LeetCode Problem | Link To NeetCode Solution |
55 | Medium | K Closest Points to Origin | Heap / Priority Queue | Link To LeetCode Problem | Link To NeetCode Solution |
56 | Medium | Kth Largest Element In An Array | Heap / Priority Queue | Link To LeetCode Problem | Link To NeetCode Solution |
57 | Medium | Task Scheduler | Heap / Priority Queue | Link To LeetCode Problem | Link To NeetCode Solution |
58 | Medium | Design Twitter | Heap / Priority Queue | Link To LeetCode Problem | Link To NeetCode Solution |
59 | Medium | Insert Interval | Intervals | Link To LeetCode Problem | Link To NeetCode Solution |
60 | Medium | Merge Intervals | Intervals | Link To LeetCode Problem | Link To NeetCode Solution |
61 | Medium | Non Overlapping Intervals | Intervals | Link To LeetCode Problem | Link To NeetCode Solution |
62 | Medium | Maximum Subarray | Greedy | Link To LeetCode Problem | Link To NeetCode Solution |
63 | Medium | Jump Game | Greedy | Link To LeetCode Problem | Link To NeetCode Solution |
64 | Medium | Jump Game II | Greedy | Link To LeetCode Problem | Link To NeetCode Solution |
65 | Medium | Gas Station | Greedy | Link To LeetCode Problem | Link To NeetCode Solution |
66 | Medium | Hand of Straights | Greedy | Link To LeetCode Problem | Link To NeetCode Solution |
67 | Medium | Merge Triplets to Form Target Triplet | Greedy | Link To LeetCode Problem | Link To NeetCode Solution |
68 | Medium | Partition Labels | Greedy | Link To LeetCode Problem | Link To NeetCode Solution |
69 | Medium | Valid Parenthesis String | Greedy | Link To LeetCode Problem | Link To NeetCode Solution |
70 | Medium | Subsets | Backtracking | Link To LeetCode Problem | Link To NeetCode Solution |
71 | Medium | Combination Sum | Backtracking | Link To LeetCode Problem | Link To NeetCode Solution |
72 | Medium | Combination Sum II | Backtracking | Link To LeetCode Problem | Link To NeetCode Solution |
73 | Medium | Permutations | Backtracking | Link To LeetCode Problem | Link To NeetCode Solution |
74 | Medium | Subsets II | Backtracking | Link To LeetCode Problem | Link To NeetCode Solution |
75 | Medium | Word Search | Backtracking | Link To LeetCode Problem | Link To NeetCode Solution |
76 | Medium | Palindrome Partitioning | Backtracking | Link To LeetCode Problem | Link To NeetCode Solution |
77 | Medium | Letter Combinations of a Phone Number | Backtracking | Link To LeetCode Problem | Link To NeetCode Solution |
78 | Medium | Number of Islands | Graphs | Link To LeetCode Problem | Link To NeetCode Solution |
79 | Medium | Max Area of Island | Graphs | Link To LeetCode Problem | Link To NeetCode Solution |
80 | Medium | Clone Graph | Graphs | Link To LeetCode Problem | Link To NeetCode Solution |
81 | Medium | Rotting Oranges | Graphs | Link To LeetCode Problem | Link To NeetCode Solution |
82 | Medium | Pacific Atlantic Water Flow | Graphs | Link To LeetCode Problem | Link To NeetCode Solution |
83 | Medium | Surrounded Regions | Graphs | Link To LeetCode Problem | Link To NeetCode Solution |
84 | Medium | Course Schedule | Graphs | Link To LeetCode Problem | Link To NeetCode Solution |
85 | Medium | Course Schedule II | Graphs | Link To LeetCode Problem | Link To NeetCode Solution |
86 | Medium | Redundant Connection | Graphs | Link To LeetCode Problem | Link To NeetCode Solution |
87 | Easy | Climbing Stairs | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
88 | Easy | Min Cost Climbing Stairs | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
89 | Medium | House Robber | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
90 | Medium | House Robber II | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
91 | Medium | Longest Palindromic Substring | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
92 | Medium | Palindromic Substrings | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
93 | Medium | Decode Ways | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
94 | Medium | Coin Change | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
95 | Medium | Maximum Product Subarray | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
96 | Medium | Word Break | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
97 | Medium | Longest Increasing Subsequence | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
98 | Medium | Partition Equal Subset Sum | 1-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
99 | Medium | Unique Paths | 2-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
100 | Medium | Longest Common Subsequence | 2-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
101 | Medium | Best Time to Buy And Sell Stock With Cooldown | 2-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
102 | Medium | Coin Change II | 2-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
103 | Medium | Target Sum | 2-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
104 | Medium | Interleaving String | 2-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
105 | Medium | Edit Distance | 2-Dimensional Dynamic Programming | Link To LeetCode Problem | Link To NeetCode Solution |
106 | Easy | Single Number | Bit Manipulation | Link To LeetCode Problem | Link To NeetCode Solution |
107 | Easy | Number of 1 Bits | Bit Manipulation | Link To LeetCode Problem | Link To NeetCode Solution |
108 | Easy | Counting Bits | Bit Manipulation | Link To LeetCode Problem | Link To NeetCode Solution |
109 | Easy | Reverse Bits | Bit Manipulation | Link To LeetCode Problem | Link To NeetCode Solution |
110 | Easy | Missing Number | Bit Manipulation | Link To LeetCode Problem | Link To NeetCode Solution |
111 | Medium | Sum of Two Integers | Bit Manipulation | Link To LeetCode Problem | Link To NeetCode Solution |
112 | Medium | Reverse Integer | Bit Manipulation | Link To LeetCode Problem | Link To NeetCode Solution |
113 | Easy | Happy Number | Math & Geometry | Link To LeetCode Problem | Link To NeetCode Solution |
114 | Easy | Plus One | Math & Geometry | Link To LeetCode Problem | Link To NeetCode Solution |
115 | Medium | Rotate Image | Math & Geometry | Link To LeetCode Problem | Link To NeetCode Solution |
116 | Medium | Spiral Matrix | Math & Geometry | Link To LeetCode Problem | Link To NeetCode Solution |
117 | Medium | Set Matrix Zeroes | Math & Geometry | Link To LeetCode Problem | Link To NeetCode Solution |
118 | Medium | Pow(x, n) | Math & Geometry | Link To LeetCode Problem | Link To NeetCode Solution |
119 | Medium | Multiply Strings | Math & Geometry | Link To LeetCode Problem | Link To NeetCode Solution |
120 | Medium | Detect Squares | Math & Geometry | Link To LeetCode Problem | Link To NeetCode Solution |