Three months is enough time to become genuinely comfortable with Data Structures and Algorithms (DSA), as long as you study in the right order and practise every day. This plan is written for college students and freshers who can already write simple programs in Java or Python, and who want to perform well in online coding tests and technical interviews.
If you only have a few weeks, read our shorter 30-day DSA roadmap instead.
Before you start: set up your system
- Pick one language and stay with it. Java or Python are both great choices. Switching languages midway wastes time.
- Use one practice platform (for example LeetCode or HackerRank) so your progress is in one place.
- Keep a mistakes notebook. For every problem you could not solve, write the key idea in one or two lines. This becomes your revision guide.
- Plan 2 hours a day: about 45 minutes learning a concept, then 75 minutes solving problems.
Month 1: foundations
Weeks 1–2: complexity, arrays and strings
Learn Big-O notation first, because every interviewer will ask about time and space complexity. Then cover arrays and strings with the patterns that appear again and again:
- Two pointers
- Sliding window
- Prefix sums
- Kadane's algorithm for maximum subarray
- Basic bit manipulation
Aim for 25–30 easy and medium problems across these patterns.
Weeks 3–4: hashing, sorting, searching and recursion
- Hash maps and sets for counting and lookups
- Binary search, including "binary search on the answer"
- Merge sort and quick sort (understand how they work, not just how to call
sort()) - Recursion and backtracking: subsets, permutations, N-Queens
Recursion feels hard at first. Draw the recursion tree on paper for small inputs; it is the fastest way to understand it.
Month 2: core data structures
Weeks 5–6: linked lists, stacks and queues
- Reverse a linked list, detect a cycle, merge sorted lists
- Stacks for balanced brackets and expression evaluation
- The monotonic stack pattern (next greater element, stock span)
- Queues and deques, including the sliding-window maximum
Weeks 7–8: trees and heaps
- Tree traversals (in-order, pre-order, post-order, level-order)
- Binary search trees: insert, search, validate
- Lowest common ancestor and tree diameter
- Heaps and priority queues for "top K" and "K-th largest" problems
By the end of month 2 you should have solved about 120 problems. Quality matters more than count: you should be able to explain every solution in your notebook.
Month 3: advanced topics and interview practice
Weeks 9–10: graphs, greedy and dynamic programming
- Graph representation, BFS and DFS
- Topological sort, Dijkstra's shortest path, minimum spanning tree and Union-Find
- Greedy problems such as interval scheduling
- Dynamic programming: start with recursion plus memoization, then convert to tabulation. Practise classics such as climbing stairs, coin change, longest increasing subsequence, longest common subsequence and 0/1 knapsack.
- Tries for prefix and word problems
Weeks 11–12: mock interviews and revision
- Do two timed mock tests per week (for example 2 problems in 60 minutes).
- Practise explaining out loud: restate the problem, give a brute-force idea, improve it, then code.
- Revise your mistakes notebook every weekend.
- Solve company-style problem sets for the companies you are applying to.
How to practise effectively
- Struggle for 25–30 minutes, then read the solution. After reading it, close the page and write the code yourself from memory.
- Re-solve problems after 3 days and again after 2 weeks. Spaced repetition makes patterns stick.
- Always dry-run your code on a small example before you submit.
- Track patterns, not just problems. Interviews test whether you recognise "this is a sliding window problem", not whether you memorised one answer.
What interviewers actually look for
Getting the right answer matters, but interviewers also judge:
- How clearly you understand the problem and ask clarifying questions.
- Whether you can start with a simple solution and improve it.
- Clean, readable code with sensible variable names.
- Correct time and space complexity analysis.
- Testing your own code with edge cases (empty input, single element, duplicates).
Learn DSA with a trainer
Self-study works, but many students lose momentum or get stuck on recursion, trees and DP. In our live online Data Structures & Algorithms course (80 hours over 8 weeks), a trainer explains each concept, codes it live in your chosen language and clears your doubts in class. You finish with 200+ solved problems, company-wise problem sets and mock coding interviews. Strengthen your basics first with Core Java or Core Python if you need to.
Book a free demo class to see how the classes work.
Frequently asked questions
Is 3 months enough to prepare for DSA interviews?
Yes, for most freshers. With about 2 hours of focused practice a day, 3 months is enough to cover the core topics, solve 150–200 problems and do several mock interviews.
Which language is best for DSA: Java or Python?
Both work well, and our DSA course is taught in Java or Python. Choose the one you are most comfortable with: Java is very common in coding tests, while Python is shorter to write. Interviewers care more about your logic than the language.
How many DSA problems should I solve?
Aim for around 150–200 well-understood problems spread across all major patterns. Solving 500 problems you cannot explain is less useful than 150 you truly understand.
Should I learn dynamic programming if I am a beginner?
Yes, but only after recursion, arrays and trees feel comfortable. Start with simple 1D problems and build up slowly.