Data structures and algorithms decide more interviews than any other topic. The online test at almost every company has at least one coding problem, and the technical interview usually has another. The trouble is that "learn DSA" can mean anything from reversing a string to segment trees, and most people waste weeks on topics their target companies never ask.
This roadmap tells you what to learn, in what order, and where to stop for the job you actually want. It also covers the part most guides skip: getting from "I can solve it" to "I can solve it while someone watches and asks questions".
Decide how far you need to go
| Your target | What the coding questions look like | Stop after |
|---|---|---|
| Base tiers at service companies (TCS Ninja, Infosys Systems Engineer, Wipro Elite, Accenture ASE, Cognizant GenC, Capgemini Analyst) | Two easy to medium problems in 45 to 90 minutes. Arrays, strings, maths, sorting, simple recursion. | Stage 2, with lots of easy practice |
| Higher tiers (TCS Digital and Prime, Infosys SP and Power Programmer, Wipro Turbo, Accenture Advanced ASE, Cognizant GenC Next) | Medium problems, sometimes one hard. Hashing, two pointers, trees, greedy, basic DP and graphs. | Stage 4 |
| Product companies and enterprise product roles (Oracle, SAP Labs, Salesforce, startups) | Medium to hard, plus follow-ups on complexity and edge cases. | Stage 5 |
If you're not sure, aim one row higher than your first instinct. The extra stages are where offers get better.
Pick one language and stay with it
Use C++, Java or Python. All three are accepted almost everywhere. Choose the one you're most fluent in, not the one that sounds most impressive. What matters:
- You can read input from standard input and print output without looking anything up. Service company tests usually work this way.
- You know your language's lists, maps, sets, sorting, heaps (priority queues) and string handling by heart.
- You know the traps: integer overflow in C++ and Java, recursion limits in Python, and string immutability in Java and Python.
The roadmap
Learn in this order. Each stage builds on the one before, and each pattern links to our guide and to practice problems.
Stage 1: foundations (1 to 2 weeks)
- Time and space complexity. Be able to say "this is O(n log n) because we sort" without hesitation.
- Arrays and strings: traversal, reversing, counting, prefix and suffix ideas, in-place updates.
- Maths: primes, GCD, modular arithmetic, digit manipulation. These turn up in service company tests a lot.
- Sorting and searching: know how merge sort and quicksort work, and use your language's built-in sort for everything else.
- Recursion: factorial, Fibonacci, power, and how the call stack works.
Stage 2: the core patterns (2 to 3 weeks)
These patterns cover most easy and medium questions:
- Hashing for counting and lookups: prefix sums and hashing.
- Two pointers on sorted arrays and strings: two pointers.
- Sliding window for subarrays and substrings: sliding window.
- Binary search, including searching on the answer: binary search on the answer.
- Stacks, including the monotonic stack: monotonic stack.
- Linked lists: reversal, fast and slow pointers, merging.
Stage 3: trees, heaps and intervals (2 weeks)
- Binary trees and BSTs: traversals (recursive and iterative), height, diameter, lowest common ancestor, level order.
- Heaps for top-k and streaming problems: heaps and top-k.
- Intervals: merging, inserting and scheduling: interval problems.
- Greedy: when a local choice is provably safe, and how to argue it.
Stage 4: graphs, backtracking and dynamic programming (3 weeks)
- Graphs: representations, BFS and DFS, connected components, cycle detection, topological sort, shortest paths: graph traversal.
- Backtracking: subsets, permutations, combinations, N-queens style search: backtracking.
- Dynamic programming: start with 1D problems (climbing stairs, house robber), then subsequences and 2D grids: DP on subsequences.
Stage 5: depth for product companies
- Tries, union-find, Dijkstra, bit manipulation.
- Harder DP (intervals, bitmasks, knapsack variants).
- Design-flavoured problems like an LRU cache.
Which problem list to follow
You don't need five lists. Pick one and finish it.
- Striver's A2Z sheet: the sheet most Indian campus candidates use. Very thorough, with videos. Best if you're starting from zero and have two to three months.
- LeetCode 75: a compact list that covers the core patterns. Best if you have a month.
- NeetCode roadmap: patterns as a tree, with video explanations. Good for seeing what depends on what.
- Grind 75: a schedule you can size to the weeks you have.
- LeetCode patterns: filter problems by pattern to drill one at a time.
For understanding rather than practice, VisuAlgo animates data structures, Abdul Bari's videos explain the classic algorithms clearly, and CP-Algorithms is the reference for anything advanced.
Our own practice problems are grouped by the same patterns, run in Python, Java, C++ and JavaScript against hidden tests, and unlock hints one at a time, so you can drill a pattern right after reading about it.
How to practise so it sticks
- Time-box each attempt. 25 minutes for an easy problem, 40 for a medium. If you're stuck, take one hint, not the whole solution.
- Re-solve after three days without looking. If you can't, you memorised it.
- Write the edge cases first: empty input, one element, all equal, negative numbers, very large inputs.
- Mix timed sets in the last two weeks: two problems in 60 minutes, just like the online test.
- Keep a mistakes log. Most people repeat the same three or four mistakes. Write them down and you'll stop.
The step most people skip: solving out loud
In the interview you don't just produce working code. You're expected to:
- Clarify the problem and its constraints.
- Explain a brute-force idea, then a better one, with complexity.
- Code while talking, so the interviewer can follow your thinking.
- Test with an example and an edge case.
- Handle the follow-up: "what if the array doesn't fit in memory?", "can you do it in O(1) space?"
Candidates who solve 300 problems in silence often freeze at step 2. Read thinking aloud in coding interviews, then practise the whole sequence in a mock coding round. The interviewer asks clarifying questions back, watches your code run against real tests, gives hints only if you ask (and counts them), and follows up the way a real panel would. The report shows whether you lost marks on the solution, the explanation or the testing, which tells you exactly what to practise next.