InterviewEra

InterviewEra is an AI-powered mock interview platform with adaptive follow-ups, resume-aware scoring, and structured interview preparation for campus placements and early-career hiring.

Start Mock Interview

Mock Interview

  • How It Works
  • Start Mock Interview
  • Campus Hiring
  • College Dashboard
  • Help Center

Free Tools

  • Interview Question Generator
  • ATS Resume Checker
  • STAR Answer Builder

Interview Questions

  • Wipro Careers Hub
  • Solera Careers Hub
  • Amazon SDE Questions
  • Microsoft SDE Questions
  • Infosys SWE Questions
  • Infosys Java Questions
  • Freshworks Frontend Questions
  • Android Developer Questions
  • Frontend Developer Questions
  • Java Developer Questions

Resources

  • Community Hub
  • All Resources
  • Blog
  • Agentic AI Interview Guide
  • What Is Agentic AI
  • Agentic Coding Round
  • AI Prompt Engineering
  • Cursor AI Interview Guide
  • DSA Topic Map
  • Placement Guide
  • STAR Guide
  • HR Guide
  • Interview Tips

Company

  • What is InterviewEra
  • About Us
  • Pricing
  • Contact

© 2026 InterviewEra. All rights reserved.

Privacy PolicyTermsRefundRanchi, Jharkhand, India
All guides

Data structures & algorithms

Top DSA Interview Questions & Topic Map

24 min read·Updated June 2026
Top DSA interview questions and topic map — arrays, hashing, trees, graphs, dynamic programming, and preparation roadmap for coding interviews in India

Quick Navigation

  • Topic landscape (chart)
  • DSA Learning Roadmap
  • Company-wise DSA Expectations
  • DSA Patterns
  • Interview Patterns vs Topics
  • Top 50 Must-Know Problems
  • Arrays, strings & hashing
  • Two pointers & sliding window
  • Linked lists
  • Trees & BST
  • Graphs
  • Dynamic programming
  • Binary search & heaps
  • Interview Communication
  • Prep timeline (chart)
  • Mistakes that cost offers
  • Related Preparation Guides
  • FAQ

About this guide

Author:
InterviewEra Team
Reviewed by:
InterviewEra Editorial
Last updated:
2026-06-06
Reviewed:
2026-06-06

Editorial review note: Content reviewed and updated for 2026 campus OAs, product company coding rounds, and DSA pattern frequency across TCS, Infosys, Amazon, Microsoft, and Google interview loops in India.

Most candidates study DSA randomly: random problems, random tags, random YouTube videos. Interview loops are not random — they sample from a skewed distribution of topics. The chart below is an illustrative composite (typical product-company and strong campus OAs): it shows relative how often each theme appears, not a guarantee for one company on one day.

Illustrative topic frequency (technical rounds + OAs)

Higher bars = more interview surface area across a typical prep cohort. Use it to order your revision, not to skip entire topics.

How to read the topic landscape

Arrays & hashing sit on top because they are the default substrate for OAs and many round-1 problems. Trees and graphs spike at product companies and strong intern pipelines. DP is asked less often by volume but is a high-variance filter: when it shows up, unprepared candidates collapse quickly.

DSA Learning Roadmap

Step-by-step path from fundamentals to interview readiness. Each stage unlocks the next — do not jump to dynamic programming before you can implement BFS on a graph without hints.

DSA learning roadmap 2026 — beginner fundamentals through arrays, hashing, linked lists, trees, graphs, dynamic programming, mock interviews, and interview readiness
DSA learning roadmap — Beginner through Arrays, Hashing, Linked Lists, Trees, Graphs, Dynamic Programming, Mock Interviews, and Interview Ready.

Beginner

Build problem-solving basics, learn time and space complexity notation, and practice simple brute-force problems before pattern templates.

Arrays

Master linear data structures — prefix sum, sliding window, and two pointers cover the majority of OA round-1 problems.

Hashing

Learn hash tables, maps, and sets. Frequency maps and counting patterns unlock two-sum variants and anagram problems.

Linked Lists

Handle dynamic structures with fast/slow pointers — reverse, merge, detect cycle, and remove nth node from end.

Trees

Explore hierarchical structures — traversals, BST validation, LCA, diameter, and level-order BFS on trees.

Graphs

Solve connected-component and shortest-path problems with BFS, DFS, topological sort, and union-find.

Dynamic Programming

Tackle optimization with memoization vs tabulation — start 1D (stairs, robber, coin change) before 2D (LCS, edit distance).

Mock Interviews

Simulate real loops with company-wise question sets, timed OAs, and spoken complexity analysis under pressure.

Interview Ready

Revise high-frequency problems, revisit weak patterns, and stay consistent — readiness is cumulative, not last-minute cramming.

Company-wise DSA Expectations

Calibrate difficulty and depth to your target company — studying Google-level DP for a TCS NQT OA wastes time; skipping graphs for Amazon SDE guarantees a filter.

DSA difficulty and focus areas by company for India interviews 2026
CompanyDifficultyFocus AreasExpected Level
TCSEasy–MediumArrays, strings, basic sorting, aptitude-heavy OAsFresher / 0–1 yr (NQT pipeline)
InfosysEasy–MediumArrays, hashing, linked lists, InfyTQ MCQs + codingFresher / 0–1 yr (InfyTQ, HackWithInfy)
WiproEasy–MediumArrays, strings, basic DS, logic & verbal sectionsFresher / 0–1 yr (Elite NTH, campus drive)
AccentureEasy–MediumArrays, pseudocode, DBMS/SQL MCQs, coding basicsFresher / 0–1 yr (ASE track)
FreshworksMediumJavaScript DSA, arrays, hashing, moderate OA problems1–3 yr (Frontend / SWE product roles)
AmazonHardTrees, graphs, DP, two pointers, Bar Raiser depthSDE I–II (OA + 2 live coding rounds)
MicrosoftMedium–HardArrays, trees, graphs, binary search, system design at seniorSDE I–II (OA + coding loop)
GoogleHardGraphs, DP, trees, advanced optimization, GoogleynessL3–L4 (phone screen + onsite coding)

DSA Patterns

Interview problems repeat as patterns, not isolated puzzles. Learn to recognize the pattern first, then map it to a template — interviewers grade pattern recognition as much as implementation.

Sliding Window

When to use: Contiguous subarray/substring problems with a running constraint — max sum, longest unique substring, fixed-size window.

Common problems:

  • Longest substring without repeating characters
  • Minimum window substring
  • Max sum subarray of size k
  • Fruit into baskets

Two Pointers

When to use: Sorted arrays, palindrome checks, pair-sum problems, or squeezing window boundaries from both ends.

Common problems:

  • Two sum II (sorted)
  • Container with most water
  • 3Sum
  • Valid palindrome

Prefix Sum

When to use: Range sum queries, subarray sum equals k, cumulative frequency tracking over indices.

Common problems:

  • Subarray sum equals k
  • Range sum query
  • Continuous subarray sum
  • Product of array except self

Binary Search

When to use: Sorted data, monotonic answer spaces, or “find minimum/maximum feasible value” optimization problems.

Common problems:

  • Search in rotated sorted array
  • Koko eating bananas
  • Find minimum in rotated array
  • Median of two sorted arrays

DFS

When to use: Tree/graph traversal, connected components, path exploration, backtracking branches where depth-first is natural.

Common problems:

  • Number of islands
  • Path sum
  • Clone graph
  • Word search

BFS

When to use: Shortest path in unweighted graphs, level-order traversal, minimum steps/spread problems.

Common problems:

  • Rotten oranges
  • Word ladder
  • Binary tree level order
  • Shortest path in binary matrix

Backtracking

When to use: Generate all combinations/permutations, constraint satisfaction, explore and undo choices.

Common problems:

  • Subsets
  • Permutations
  • Combination sum
  • N-Queens
  • Word search II

Greedy

When to use: Local optimal choices lead to global optimum — scheduling, interval merging, Huffman-style problems.

Common problems:

  • Merge intervals
  • Jump game
  • Non-overlapping intervals
  • Assign cookies

Dynamic Programming

When to use: Overlapping subproblems + optimal substructure — counting paths, knapsack family, sequence alignment.

Common problems:

  • Climbing stairs
  • House robber
  • Coin change
  • Longest increasing subsequence
  • Edit distance

Interview Patterns vs Topics

Patterns are reusable templates; topics are the data structures they apply to. Use this map to plan revision — when you drill sliding window, prioritize array and string problems first.

Mapping of DSA interview patterns to relevant topics
PatternRelevant Topics
Sliding WindowArrays, Strings, Hashing
Two PointersArrays, Linked Lists, Strings
Prefix SumArrays, Hashing
Binary SearchArrays, Trees, Heaps
DFSTrees, Graphs, Backtracking
BFSGraphs, Trees, Matrices
BacktrackingTrees, Graphs, Arrays, Strings
GreedyArrays, Graphs, Heaps, Intervals
Dynamic ProgrammingArrays, Strings, Trees, Graphs

Top 50 Must-Know DSA Problems

These 50 problems cover the highest-frequency patterns across campus OAs and product company loops. Solve each once, then re-solve after 5–7 days without looking at solutions. Focus on pattern recognition, not memorizing code.

Arrays (9 problems)

  • Two Sum
  • Best Time to Buy and Sell Stock
  • Product of Array Except Self
  • Maximum Subarray (Kadane)
  • Merge Intervals
  • Rotate Array
  • Find Missing Number
  • Container With Most Water
  • Trapping Rain Water

Hashing (8 problems)

  • Group Anagrams
  • Valid Anagram
  • Longest Consecutive Sequence
  • Subarray Sum Equals K
  • Top K Frequent Elements
  • First Missing Positive
  • Longest Substring Without Repeating Characters
  • Isomorphic Strings

Linked Lists (7 problems)

  • Reverse Linked List
  • Merge Two Sorted Lists
  • Linked List Cycle
  • Remove Nth Node From End
  • Reorder List
  • Add Two Numbers
  • Copy List with Random Pointer

Trees (9 problems)

  • Maximum Depth of Binary Tree
  • Invert Binary Tree
  • Diameter of Binary Tree
  • Lowest Common Ancestor of BST
  • Validate Binary Search Tree
  • Binary Tree Level Order Traversal
  • Serialize and Deserialize Binary Tree
  • Path Sum III
  • Construct Binary Tree from Preorder and Inorder

Graphs (8 problems)

  • Number of Islands
  • Course Schedule
  • Rotting Oranges
  • Word Ladder
  • Clone Graph
  • Pacific Atlantic Water Flow
  • Network Delay Time
  • Redundant Connection

Dynamic Programming (9 problems)

  • Climbing Stairs
  • House Robber
  • Coin Change
  • Longest Increasing Subsequence
  • Word Break
  • Unique Paths
  • Edit Distance
  • Maximum Product Subarray
  • Partition Equal Subset Sum

Arrays, strings & hashing

Canonical patterns: frequency maps, prefix sums, sorting as preprocessing, index mapping.

  • Two sum / k-sum family (hash map or sort + two pointers).
  • Longest substring without repeat / at most k distinct (sliding window).
  • Subarray sum equals k (prefix sum + hash map).
  • Merge intervals and meeting-room style scheduling.

Two pointers & sliding window

Often combined with arrays or strings. Interviewers use these to test whether you can maintain invariants while moving indices — not whether you memorized a template.

  • Container with most water, trapping rain water (two pointers from ends).
  • Minimum window substring / smallest subarray with sum ≥ target.
  • Fast/slow pointer for cycle detection (also linked lists).

Linked lists

  • Reverse linked list (iterative + recursive).
  • Merge two sorted lists, add two numbers represented as lists.
  • Detect cycle (Floyd), find intersection of two lists.

Trees & BST

  • Traversals, height/depth, balanced tree check, diameter of binary tree.
  • LCA in BST vs LCA in binary tree.
  • Path sum variants, serialize/deserialize tree.

Graphs

  • Number of islands, rotten oranges, word ladder (BFS layering).
  • Course schedule / topological sort.
  • Connected components, DFS on grid vs adjacency list.

Dynamic programming

Start with 1D DP (climbing stairs, house robber, coin change) before 2D (LCS, edit distance). Interviewers often accept O(n²) with clear state definition over a rushed “optimized” solution you cannot explain.

Binary search & heaps

  • Binary search on answer space (Koko eating bananas, split array largest sum).
  • Median from data stream, merge k sorted lists, top k frequent elements.

Interview Communication

Strong DSA knowledge without spoken communication loses offers. Product company panels explicitly grade how you think aloud — practice narration as seriously as problem-solving.

Explaining your approach

Before coding, restate the problem, confirm constraints, and walk through 1–2 examples including edge cases. Interviewers grade whether you de-risk ambiguity before writing code.

Tip: Use a 30-second outline: brute force → bottleneck → optimized approach. Ask “Does this match what you had in mind?” before implementing.

Complexity discussion

Always state time and space complexity after your solution. Explain why — count nested loops, hash map lookups, recursion depth — not just Big-O labels.

Tip: Compare brute force vs optimized complexity aloud. Example: “Hash map brings this from O(n²) to O(n) with O(n) extra space.”

Optimization discussion

Interviewers often ask “Can you do better?” even after a correct answer. Know trade-offs: time vs space, preprocessing vs query, iterative vs recursive.

Tip: If stuck, say what you would try next — sorting, two pointers, prefix sums — rather than going silent.

Interviewer communication

Think aloud during coding. Flag when you are stuck, state assumptions, and recover gracefully from bugs. Silence reads as inability, not deep thinking.

Tip: Run a dry-run on your example before saying “done.” Verbalize each line’s purpose as you write it.

Prep timeline: three tracks in parallel

The line chart below is illustrative: it shows how readiness might grow if you keep core DS, pattern depth, and mock interviewsmoving together. Mocks that start too late produce a flat green curve in real life — don't wait until week 8 to speak out loud.

Illustrative readiness over 10 weeks

Y-axis: self-rated readiness 1–10. Your curve will differ — use the shape as a planning reminder, not a prediction.

Mistakes that cost offers

  1. Only coding in silence. Interviews grade communication. Narrate assumptions, complexity, and trade-offs.
  2. Skipping complexity. Always state time and space; invite follow-ups on optimization.
  3. One-shot practice. Re-solve the same problem after 5–7 days (spaced repetition).
  4. Ignoring OAs. Many Indian campus pipelines filter hard on timed OAs — practice under timer and partial scoring mindset.

Related Preparation Guides

Cross-train with role and company-specific question banks. DSA overlaps heavily with software engineer loops — pair this guide with company hubs for your target employers.

Software Engineer Questions →Amazon SWE Questions →Microsoft SWE Questions →Infosys SWE Questions →Java Developer Questions →Frontend Developer Questions →Google SWE Questions →Freshworks SWE Questions →Freshworks Frontend Questions →TCS Interview Questions →TCS SWE Questions →Wipro Interview Questions →Accenture Interview Questions →Infosys Java Questions →TCS Java Questions →Algorithms Interview Questions →Agentic AI Interview Round Guide →System Design Questions →JavaScript Interview Questions →React Interview Questions →Top SWE Interview Questions →HR Interview Questions →Behavioral Interview Prep →Placement Interview Guide →STAR Method Guide →Free Question Generator →InterviewEra Mock Interviews →

Frequently Asked Questions

How many DSA problems should I solve before interviews?

Aim for 150–200 quality problems across patterns rather than 500 random solves. Cover top 50 must-know problems deeply, then expand by weak patterns. Re-solve key problems after 5–7 days for retention.

Which DSA topic is most important for campus placements?

Arrays and hashing appear most frequently in Indian campus OAs (TCS NQT, Infosys InfyTQ, Wipro Elite). Master two pointers, sliding window, and prefix sum before moving to trees and graphs.

Is LeetCode enough for DSA interview prep?

LeetCode is a strong practice platform but not sufficient alone. Pair problem-solving with timed OAs, spoken mock interviews, and company-specific pattern review. Communication and complexity analysis matter as much as AC rate.

How long does DSA prep take for product companies?

Most candidates need 8–12 focused weeks: 4 weeks on arrays/hashing/lists, 3 weeks on trees/graphs, 2 weeks on DP, and ongoing mocks from week 6 onward. Amazon and Google typically require the full timeline.

Do service companies ask hard DSA questions?

TCS, Infosys, Wipro, and Accenture focus on easy–medium arrays, strings, and basic logic in OAs. Live technical rounds may add linked lists or simple trees but rarely hard DP or graph optimization.

Should I learn DSA in Java or C++?

Use whichever language you will code in during interviews. Java and C++ are both common in India campus drives. Python is acceptable at many product companies but confirm with your target company first.

What is the best order to learn DSA topics?

Follow the learning roadmap: Beginner → Arrays → Hashing → Linked Lists → Trees → Graphs → Dynamic Programming → Mock Interviews → Interview Ready. Each stage builds on the previous — skipping hashing makes tree and graph problems harder.

How important is dynamic programming for fresher interviews?

DP is less frequent in service-company OAs but is a high-variance filter at Amazon, Google, and Microsoft. Learn 1D DP (climbing stairs, house robber, coin change) before 2D DP (LCS, edit distance).

How do I practice DSA under time pressure?

Simulate OAs weekly: 2–3 problems in 60–90 minutes with no hints. Use a timer for individual problems (25–35 min). Track which patterns slow you down and drill those specifically.

What DSA patterns appear most in Amazon interviews?

Amazon SDE loops heavily test trees, graphs, BFS/DFS, two pointers, and medium DP. OA filters on arrays and strings first — strong OA performance is required before live coding rounds.

Can I skip graphs if I am targeting service companies?

For TCS/Wipro/Accenture campus drives, basic graph awareness is enough. Infosys Power Programmer and all product company tracks require BFS/DFS fluency — do not skip graphs if you have product company targets.

How do I explain time complexity in interviews?

Count operations as a function of input size n. State best, average, and worst case when relevant. Tie complexity to your data structures: “Hash map lookups are O(1), so the overall loop is O(n).” Always mention space complexity too.

Generate role-shaped question sets with our free interview question generator, tighten behavioral stories with the STAR answer builder, and line up full sessions with InterviewEra mock interviews.

Turn topics into spoken practice

Upload your resume, run AI mock interviews, and get rubric-style feedback — not just more random problems.

Start free practice

Related concepts

  • DSA
  • Agentic AI
  • System Design
  • Software Engineer

Learn next

Continue in this order for the fastest path through this topic.

  1. Step 1Software Engineer HubFull SWE loop context
  2. Step 2What Is Agentic AI?AI-assisted rounds in 2026
  3. Step 3AI Mock InterviewApply patterns under time pressure

Recommended tools

  • Question GeneratorRole-specific practice problems
  • AI Mock InterviewTimed mocks with rubric-style feedback
  • ATS Resume CheckerImprove resume keyword match
  • STAR Answer BuilderStructure behavioral stories

Related Guides

  • Software EngineeringWipro Software Engineer Interview Questions and Answers (2026)Wipro SWE guide — NLTH, DSA, OOP, DBMS, SQL, salary, 30-day roadmap, and expert sample answers.
  • Interview StrategyAgentic AI Interview Round (2026): The Ultimate GuideMaster agentic AI interview rounds — evaluation rubrics, 50+ questions, India trends, prep roadmaps, and sample workflows for AI-assisted coding interviews.
  • Software EngineeringSoftware Engineer Interview Questions (2026)SWE prep hub — DSA, system design, OOPs, hiring process, company comparison, 30-day roadmap, and mock interview CTA.
  • Software EngineeringTop Interview Questions for Software Engineers (2026)Most frequently asked SWE interview questions across DSA, system design, and behavioral rounds.
  • Software EngineeringAmazon Software Engineer Interview Questions (2026)Amazon SDE guide — OA, Leadership Principles, Bar Raiser, DSA, and 4-week roadmap.
  • Software EngineeringMicrosoft Software Engineer Interview Questions (2026)Microsoft SDE guide — Online Assessment, coding rounds, system design, and growth mindset.