DSA Tracker

Blog

Guide

Your First 30 DSA Problems: What Order to Solve Them In

Stop solving random problems. Master these 30 DSA questions in a specific order to build the logic patterns required for your coding interviews.

Riya Kushwaha, DSA Tracker team3 min read
On this page

You should solve your first 30 problems in a fixed sequence: start with arrays and hashing, move to two pointers, handle simple strings, tackle stacks, and finish with binary search and linked lists. Order matters more than count because each topic builds the mental model for the next. If you jump between topics, you never learn the underlying pattern.

The logic of the sequence

Start with arrays and hashing because they are the foundation of memory management in code. When you solve Contains Duplicate, you learn how a hash map stores values to avoid nested loops. This reduces time complexity from O(n^2) to O(n). Once you understand how to store data, move to two pointers. Problems like Two Sum II require you to manipulate indices rather than creating new data structures. This teaches you how to traverse an array efficiently.

Simple strings are just arrays of characters. If you can reverse an array, you can reverse a string. Use this to practice your pointer logic. After strings, move to stacks. A stack is just a restricted array where you only add or remove from one end. Problems like Valid Parentheses force you to track state, which is a jump in complexity from simple iteration.

Binary search is the first time you learn to discard half of your search space. This is not just about sorting; it is about reducing O(n) to O(log n). Finally, linked lists force you to handle pointers manually. If you try linked lists before arrays, you will struggle with the syntax because you are still learning how to think about memory.

A worked example

Consider the Two Sum problem where the input array is [2, 7, 11, 15] and the target is 9. If you use a brute force approach, you check 2+7, 2+11, 2+15, 7+11, and so on. That is 6 operations. If you use a hash map, you iterate once. You see 2, store it as {2: 0}. You see 7, check if 9-7 exists in the map. It does. You return the indices [0, 1]. This logic of checking for a complement is the core pattern for dozens of harder problems.

The rule of thumb

  • Spend 45 minutes on a problem before looking at the solution.
  • If you look at the solution, write the code from memory the next day.
  • Do not move to a new topic until you can solve three problems in the current one without help.
  • Focus on the pattern, not the specific input values.

Why order beats volume

Most students try to hit a target of 300 problems without understanding the first 30. If you solve 30 problems in the wrong order, you are just memorizing code. If you solve them in this order, you are building a toolkit. When you see a new problem, you will not ask what the code is. You will ask if you can use a hash map to store state or if two pointers can reduce the search space.

DSA Tracker helps you track this progression so you do not repeat topics you have already mastered. You need to know when to stop practicing arrays and when to start binary search. The goal is to recognize the pattern in the first 30 seconds of reading the problem statement. If you cannot identify the pattern, you are not ready for the next topic.

Pick one problem from the arrays category and solve it using a hash map today.

Keep going with practice problems and the online compiler.

Further reading: Binary search on Wikipedia.

Share

XLinkedInWhatsApp

Frequently asked questions

Should I use C++ or Python for these 30 problems?

Use the language you are most comfortable with. The logic of the algorithm remains the same regardless of the syntax. Focus on the pattern, not the language features.

How do I know if I have mastered a topic?

You have mastered a topic when you can explain the time and space complexity of your solution without hesitation and can solve a medium-level problem on your own.

What if I get stuck on a problem for more than an hour?

Stop. Read the editorial or watch a video explanation to understand the underlying pattern. Then, close the solution and implement it yourself from scratch.

Practice what you just read

Keep reading