How to Learn DSA in 2025: The Complete Step-by-Step Roadmap
Learn DSA with this 6-month detailed roadmap. Perfect for beginners, covers key DSA topics, timelines, LeetCode problems and a clear study plan.
If you're just starting out in coding or planning a switch to tech, you've probably been told to “learn DSA.”
And you’ve likely wondered: What is DSA? Why is it so important? And how do I even begin?
DSA stands for Data Structures and Algorithms. Think of it as the foundation of good programming.
Data structures are ways to store and organise information. Algorithms are step-by-step methods to solve problems.
Together, they form the core of every coding interview, especially at top tech companies like Google, Amazon, and other product-based startups.
📍 But here’s the problem: Many beginners feel lost. Some jump straight into LeetCode. Some give up after failing a few problems.
That’s why we created this beginner-friendly DSA roadmap - a clear, 25-week plan designed to take you from zero to interview-ready.
Whether you’re from a CS background or not, this guide will show you how to learn DSA step-by-step, with timelines, key DSA topics, and the important questions to practice.
💡We'll break everything into 5 parts over 25 weeks:
✅ Weeks 1-3: Build strong foundations
✅ Weeks 4-9: Master core data structures
✅ Weeks 10-15: Learn advanced data structures
✅ Weeks 16-21: Master algorithm strategies
✅ Weeks 22-25: Prepare for interviews
✅ Beyond: Some best practices
Let’s get started.
Part 1: Essential Foundations (Week 1-3)
The biggest mistake beginners make? Jumping straight into hard problems without building the basics. Don't be that person. Spend these 3 weeks getting your foundation rock-solid.
📌 Choose Your Programming Language
Before jumping into DSA, you need one basic tool: a programming language.
Don't stress too much over which one to choose. For DSA, any of these three will work well:
- Java – used widely in interviews and courses
- Python – clean syntax, beginner-friendly
- C++ – fast and powerful, great for competitive coding
The key is: pick one and stick with it throughout your journey. Switching between languages will only slow you down.
What you should learn:
- How to write basic programs (print, take input, use variables)
- Loops (for, while), conditionals (if/else)
- Arrays and strings (just the basics for now)
- How to define and use functions
You don’t need to master everything yet, just enough to solve simple problems.
📌 Core Problem-Solving Concepts
Before you touch any data structure, learn how to think about problems.
1. Understand the Problem First
Don’t rush. Read the problem carefully, identify inputs/outputs, think of edge cases, and try small examples by hand.
2. Plan Before You Code
Break the problem into steps. Think of similar problems and sketch out your logic before jumping into code.
3. Common Problem-Solving Patterns Learn these patterns early. You'll see them everywhere:
- Two Pointers: Use two variables to track positions
- Sliding Window: Move a "window" across data
- Fast and Slow Pointers: Different speeds to find patterns
- Divide and Conquer: Break problem into smaller parts
📌 Time and Space Complexity Analysis
Every problem has more than one solution. But in interviews, you're not just expected to solve it — you're expected to solve it efficiently.
That’s where time and space complexity come in.
→ Time complexity tells you how fast your code runs as input grows.
→ Space complexity tells you how much memory it uses.
Common Big O notations you must know:
✔ O(1) - Constant time. Same speed regardless of input size. Example: Accessing an array element by index
✔ O(n) - Linear time. Time grows with input size. Example: Finding an element in an unsorted array
✔ O(n²) - Quadratic time. Time grows as the square of the input. Example: Nested loops through an array
✔ O(log n) - Logarithmic time. Very efficient. Example: Binary search in a sorted array
Recommended Platforms for Practice:
- LeetCode - Best for interview prep, huge question bank
- HackerRank - Good explanations, beginner-friendly
- CodeChef - Great for competitive programming
💡 Recommended resource: AI LeetCode Mentor extension
To get better at solving problems step by step, try this free coding extension. It sits on the side of your screen and gives you hints, feedback, and guidance without spoiling the solution, like a coding mentor nudging you in the right direction.
Great for building real interview-style thinking early on. 👇
Book a Trial Session
to understand how Aman can help
Right-fit check
Timeline clarity
Pricing alignment
Top bottlenecks
Weekly milestones
30-45 min session
Next Available: Fri May 15 2026
Part 2: Core Data Structures (Weeks 4–9)
This is where most of your learning happens. If you master these four core data structures, you’ll be able to solve over 70% of coding interview questions.
📌 Arrays and Strings
Arrays are the foundation of almost every data structure and algorithm. Strings are just arrays of characters, so they often use the same logic.
Your goals should be:
- Learn how to insert, delete, search, and sort in arrays
- Get confident with two-pointer and sliding window techniques
- Handle common string operations like reversing, comparing, and building substrings
These two topics are heavily tested in interviews, especially at startups and service-based companies.
✅ Here are some essential problems to solve:
- Two Sum
- Best Time to Buy and Sell Stock
- Contains Duplicate
- Maximum Subarray
- Move Zeroes
- Valid Palindrome
- Group Anagrams
- Longest Substring Without Repeating Characters
📌 Linked Lists
Unlike arrays, linked lists don’t need a fixed size. They use pointers, which makes them trickier at first but very powerful later.
You should learn:
- How to create a linked list from scratch
- How to traverse, insert, and delete nodes
- When to use singly vs. doubly linked lists
- Two-pointer technique and fast-slow pointer tricks (very common in interviews)
✅ Some important questions to solve:
- Reverse Linked List
- Merge Two Sorted Lists
- Detect Cycle in Linked List
- Remove Nth Node From End
- Middle of the Linked List
- Palindrome Linked List
If you're stuck, draw the list on paper. Visualising helps a lot.
📌 Stacks and Queues
These are simple but very useful structures. They’re used in recursion, parsing expressions, browser history, and more.
A stack follows the Last-In-First-Out (LIFO) rule, like a stack of plates.
A queue follows the First-In-First-Out (FIFO) rule, like a queue at a store.
You should learn:
- How to implement a stack/queue using arrays or linked lists
- When to use a stack vs. a queue
- Basic applications like undo/redo or level-order traversal
✅ Some great practice problems:
- Valid Parentheses
- Min Stack
- Implement Queue using Stacks
- Daily Temperatures
- Next Greater Element
Try building your own stack and queue in code first. Then move to solving problems.
📌 Hash Tables / Hash Maps
Hash tables are one of the most useful tools in problem solving. They let you store data and access it in constant time—O(1)—which is incredibly fast.
They’re used for:
- Checking for duplicates
- Counting elements
- Grouping data
- Fast lookups
This is one of the most important topics in the DSA roadmap for beginners and should not be skipped. Essential problems to try:
- Two Sum (again, but now using a hash map)
- Group Anagrams
- Valid Anagram
- Top K Frequent Elements
- Longest Substring Without Repeating Characters
- Subarray Sum Equals K
- Minimum Window Substring
Make sure you understand how hash maps work in your chosen language. In Java, it's HashMap; in Python, it's just dict.
When you’re learning arrays, linked lists, or hash maps, it’s easy to get stuck or miss key steps in your logic. Just watching solutions or jumping to hints won’t help unless you understand how to approach problems from scratch.
That’s where the AI LeetCode Mentor extension helps.
It doesn’t spoon-feed you answers. Instead, it acts like a senior engineer—guiding your thinking, pointing out what you're missing, and helping you build the muscle to solve these problems on your own. 💯
Part 3: Advanced Data Structures (Weeks 10–15)
Now that you've mastered the basics, it’s time to level up. These advanced data structures come up often in FAANG interviews and coding rounds for top product-based companies.
Even if you're not aiming for those roles right now, learning them will make you a much stronger problem solver.
You’ll also notice that many of the harder LeetCode questions revolve around these structures.
📌 Trees
Trees are used in file systems, HTML pages, databases, and much more. A Binary Tree is the most common type—each node has at most two children. A Binary Search Tree (BST) is a special tree where left < root < right, which makes searching fast.
Here’s what to focus on:
- Tree traversals: in-order, pre-order, post-order, level-order
- Recursive and iterative solutions
- BST operations: insert, search, delete
- Balanced vs. unbalanced trees
✅ Important LeetCode-style problems to try:
- Maximum Depth of Binary Tree
- Invert Binary Tree
- Validate BST
- Symmetric Tree
- Binary Tree Level Order Traversal
- Lowest Common Ancestor
- Path Sum
Tip: Always draw the tree on paper when solving tree problems. Visualising helps you think better.
📌 Heaps and Priority Queues
A heap is a special tree that’s always partially sorted. It’s used in scheduling tasks, handling real-time data, and finding top-k elements.
The two types:
- Min-Heap: The smallest element is at the root
- Max-Heap: The largest element is at the root
Most languages provide built-in heap support:
- In Java: PriorityQueue
- In Python: heapq
✅ Focus on these problems:
- Kth Largest Element in an Array
- Top K Frequent Elements
- Merge K Sorted Lists
- Find Median from Data Stream
- Sliding Window Maximum
📌 Graphs
A graph is a collection of nodes and edges. It models relationships—like friends in a network, roads in a city, or pages on the internet.
There are many types:
- Undirected vs. Directed
- Weighted vs. Unweighted
- Cyclic vs. Acyclic
Start with the basics:
- Representing graphs using adjacency lists
- Implementing DFS (Depth-First Search)
- Implementing BFS (Breadth-First Search)
Once you’re comfortable, learn about shortest paths and connected components.
✅ Must-solve graph problems:
- Number of Islands
- Clone Graph
- Course Schedule
- Word Ladder
- Graph Valid Tree
- Pacific Atlantic Water Flow
- Rotting Oranges
Graphs are tricky at first, so take your time. Focus on understanding how BFS and DFS actually work.
📌 Special Structures: Trie & Union-Find
If you’re aiming for FAANG interviews, learning these structures gives you a big edge.
→ Trie (Prefix Tree)
Used in problems involving words and strings. Helps with autocomplete features and dictionary-related tasks.
Try these: Implement Trie, Word Search II
→ Union-Find (Disjoint Set)
Great for grouping problems or checking if elements are connected. Shows up in network and graph-related questions.
Practice: Number of Islands (Union-Find version), Friend Circles, Redundant Connection
If it still feels hard, that’s okay. These are advanced topics. Go back, revise weak spots, and keep practising. You’re already ahead of most beginners by reaching this stage. ✅
Next up: the most powerful tools in your DSA journey → algorithms and problem-solving patterns that help you solve tough questions faster.
Book a Trial Session
to understand how Aman can help
Right-fit check
Timeline clarity
Pricing alignment
Top bottlenecks
Weekly milestones
30-45 min session
Next Available: Fri May 15 2026
Part 4: Algorithm Strategies (Week 16-21)
This section is the heart of the DSA roadmap — and it’s where you’ll start to feel like a confident problem solver.
The algorithmic strategies you’ll learn here can solve 80% of coding interview questions.
Most questions use a mix of patterns like binary search, recursion, dynamic programming, or greedy. Let’s break each down
📌 Searching and Sorting
You’ve been using arrays and lists. Now it’s time to learn how to search and sort data efficiently.
Start with binary search — it cuts the search space in half with each step. But remember: it only works on sorted data.
→ Example: Guessing a number between 1 and 100? Start at 50. Too high? Try 25. That’s binary search.
Each guess eliminates half the remaining numbers. It works the same way with arrays. This turns a slow O(n) search into a lightning-fast O(log n) operation.
Common sorting algorithms you should know include merge sort and quick sort. Both use a divide-and-conquer strategy. Break the big problem into smaller pieces, solve each piece, then combine the results.
✅ Must-solve problems:
- Binary Search
- Find First and Last Position of Element in Sorted Array
- Search in Rotated Sorted Array
- Find Peak Element
- Search a 2D Matrix
- Merge Intervals
- Sort Colors
- Insert Interval
- Largest Number
- Meeting Rooms II
📌 Recursion and Backtracking
Recursion means a function calls itself. It’s how humans solve problems naturally.
Example: Cleaning a room? Start with one area, then do the rest. That’s recursion.
The key to recursion is identifying the base case (when to stop) and the recursive case (how to make the problem smaller).
Backtracking builds on recursion. You explore one option, and if it doesn’t work, you go back and try another. It's like solving a maze by trying different routes and returning to previous intersections when you hit dead ends.
✅ Important Recursion and Backtracking Problems:
- Generate Parentheses
- Subsets
- Permutations
- Combination Sum
- N Queens
- Word Search
Tip: Draw recursion trees on paper. It helps you track function calls and returns.
📌 Dynamic Programming
DP looks complex, but it's simple once you get the idea: store answers to subproblems so you don't repeat work.
Imagine calculating the 50th Fibonacci number. The naive recursive approach recalculates the same values thousands of times. DP calculates each value once and stores it for future use.
Two main approaches exist for DP problems.
→ Top-down approach (memoization) starts with the big problem and breaks it down, storing results along the way.
→ In the bottom-up approach, you solve the smallest subproblems first and gradually work your way up to the complete solution.
How to recognise DP problems: Look for problems where you solve the same smaller parts again and again. Also, if solving the big problem depends on the best way to solve its smaller parts, it’s likely a DP problem.
✅ Must-solve problems:
- Climbing Stairs
- House Robber
- Maximum Subarray
- Coin Change
- Longest Increasing Subsequence
- Unique Paths
- Jump Game
- Palindromic Substrings
- Longest Common Subsequence
- Edit Distance
- Decode Ways
- Word Break
- Triangle
- Maximum Product Subarray
- Best Time to Buy and Sell Stock with Cooldown
These topics take time to click. If you’re struggling to break problems down or write code from scratch, try using the AI LeetCode Mentor. ✅
It’ll walk you through the logic step-by-step without giving away the full solution, perfect for topics like recursion, DP, and backtracking, where brute force is tempting but inefficient.
📌 Greedy Algorithms
Greedy algorithms pick the best option at each step, aiming for a full solution that’s good enough or sometimes even perfect. The goal is to reach the best overall solution by making quick decisions.
Sometimes this works perfectly. Sometimes it fails miserably. The trick is knowing when greedy approaches are correct.
Classic examples include making change with coins (always use the largest denomination possible) and scheduling activities (always pick the activity that finishes earliest).
✅ Must-solve greedy problems:
- Best Time to Buy and Sell Stock II
- Jump Game
- Gas Station
- Candy
- Non-overlapping Intervals
- Queue Reconstruction by Height
- Partition Labels
- Minimum Number of Arrows to Burst Balloons
📌 Bit Manipulation
Bit manipulation means solving problems using the binary form of numbers. It's incredibly fast and elegant when applicable.
Essential bit operations include AND, OR, XOR, and bit shifting. XOR is particularly useful because of two unique traits: doing XOR with the same number gives 0, and XOR with 0 keeps the number unchanged.
✅ Must-solve bit manipulation problems:
- Single Number
- Number of 1 Bits
- Counting Bits
- Missing Number
- Reverse Bits
- Power of Two
The combination of data structures knowledge and algorithmic thinking makes you a strong problem solver.
Part 5: Interview Preparation (Week 22-25)
All that practice leads to this moment. Time to prepare for actual interviews.
Different companies have different expectations. A Google interview looks very different from a startup interview. Understanding these differences helps you prepare effectively.
📌 Understand the Interview Format
Not all companies look for the same thing. Before you apply, understand what kind of DSA preparation each company type expects:
1. FAANG Companies (Google, Amazon, etc.):
Expect medium to hard-level problems. You'll face 4-5 rounds focused on problem-solving, system design (for experienced roles), and behavioural questions. Clear communication and edge case handling are key.
2. Startups:
Focus more on real-world logic, coding fluency, and sometimes live coding or small take-home projects. DSA questions are usually easier, but they test your thought process.
3. Service-Based Companies (Infosys, TCS, etc.):
Interviews are more structured. You’ll mostly face easy to medium DSA questions, along with basic CS concepts like OOPs, DBMS, and SQL.
So, tailor your prep accordingly. Don’t overdo advanced DP if you're targeting entry-level service-based roles.
📌 Focus on High-Frequency Problems
Don’t just solve random LeetCode problems. Prioritise questions that actually get asked in interviews.
👉 Start with this curated list of 50 most-asked DSA questions — handpicked from real interviews across FAANG, startups, and service-based companies.
📌 Practice Under Real Interview Conditions
Doing LeetCode at your own pace is different from doing it under pressure.
To build this, use the Interview Mode in this free AI LeetCode Mentor to mimic real interview conditions.
⏱️ Set the timer, solve the question, and submit.
📊 Get instant feedback on correctness, edge cases, time/space complexity, and problem-solving steps.
This isn't just another chatbot. It acts like a senior engineer guiding you through your blind spots, without giving away the answer.
✅ Practising like this builds the speed, confidence, and clarity you need in real interviews. It’s better than just guessing and hoping for the best.
Book a Trial Session
to understand how Aman can help
Right-fit check
Timeline clarity
Pricing alignment
Top bottlenecks
Weekly milestones
30-45 min session
Next Available: Fri May 15 2026
Best Practices and Next Steps
After completing the 25-week roadmap for DSA, the next step is simple: keep the momentum going. DSA is a skill that grows with practice.
Here's how to maintain and improve your skills long-term.
🕒 Keep Practising (based on your schedule)
▶️ If you’re working: Aim for 1 hour a day. Just 1–2 solid problems — focus on understanding, not speed. Use weekends to revise or tackle harder ones.
▶️ If you’re a student: 2–3 hours daily is ideal. Mix new topics with review.
▶️ After you get a job: 2–3 problems a week is enough to stay in shape. Join monthly contests to stay in the game.
📈 Track Your Progress
→ Use a sheet to log what you solved and how hard it felt.
→ Highlight questions where you needed hints or got stuck.
→ Every month, check for patterns like slow logic or missed edge cases.
→ Set mini-goals (like “50 medium problems” or “master recursion”) and treat yourself when you hit them!
Want a personalised DSA roadmap built for your unique goals, background, and timeline?
You can connect 1:1 with a senior engineer from MAANG or your dream company and get 1:1 guidance.
The first session is free :)
Your DSA Journey Doesn't End Here
This 25-week DSA roadmap for beginners gives you a strong foundation. But real growth comes from consistent practice, clear thinking, and knowing what to improve.
And while staying consistent is up to you — getting better feedback doesn’t have to be hard.
Use the AI LeetCode Mentor extension as your personal coding mentor alongside this roadmap. It gives you instant feedback, highlights your blind spots, and helps you build real interview-style thinking, step by step. ✅
Give it a shot — it’s free, easy to use, and installs in seconds.
Good luck on your journey to learn DSA and become interview-ready! 💪
Recommended reading: