11 DSA Interview Questions Indian Freshers Must Master

11 most asked DSA interview questions for Indian freshers with what interviewers test. Master linked lists, arrays, trees, DP patterns to crack TCS, Infosys, product company rounds.

PrepFox Team·
11 DSA Interview Questions Indian Freshers Must Master

11 DSA Interview Questions Indian Freshers Must Master

If you're applying for developer roles in India — TCS, Infosys, Accenture, or product companies like Razorpay and Zoho — DSA questions decide whether you get the offer. Per AmbitionBox data from 4.2 lakh Indian developer salaries, entry-level roles pay ₹4-8 LPA, and the gatekeeper is almost always a DSA round.

Most Indian freshers memorize 200+ LeetCode problems and still freeze when the interviewer asks a slightly different question. The fix is understanding core patterns — not rote-learning solutions. Here are 11 high-frequency DSA questions that appear repeatedly in Indian campus and off-campus interviews.

1. Reverse a Linked List

What they test: Pointer manipulation, understanding of how linked lists work in memory.

The interviewer wants to see if you can traverse a linked list and reverse the "next" pointers one at a time using three variables: prev, current, and next. Iterate through the list, storing the next node before changing the current's pointer. Common follow-up: reverse in groups of K — asked at Amazon and Microsoft India.

2. Detect a Cycle in a Linked List

What they test: Floyd's cycle detection algorithm (tortoise and hare).

Use two pointers — slow moves one step, fast moves two. If they meet, there's a cycle. Asked so often in Indian service-company interviews that not knowing it is an instant rejection.

3. Find the Missing Number in an Array

What they test: Mathematical reasoning, bitwise operations.

Given n-1 numbers from 1 to n, find the missing one. Sum formula (n*(n+1)/2 minus array sum) works, but XOR all elements with 1 to n avoids overflow — a detail that shows edge-case thinking.

4. Valid Parentheses

What they test: Stack data structure, matching logic.

Given a string of brackets, check if they're balanced. Push openings onto a stack; for each closing bracket, check if the top matches. Tests whether you know when to use a stack — a pattern in expression evaluation and undo operations.

5. Two Sum Problem

What they test: Hash maps, time-space tradeoffs.

Given an array and target, find two numbers that sum to it. The O(n²) brute force is obvious — interviewers want the O(n) hash map approach. Tests whether you can trade space for time.

6. Binary Tree Level-Order Traversal

What they test: Queue usage, BFS traversal.

Traverse a binary tree level by level using a queue. Foundation for harder tree questions like right-side view and zigzag traversal. If you can't do this, interviewers won't escalate.

7. Merge Two Sorted Arrays

What they test: Two-pointer technique, in-place modification.

Given two sorted arrays, merge them. The two-pointer approach (compare both, pick smaller) appears in merge sort and interval problems. Product companies often add the in-place constraint.

8. Find Duplicates in an Array

What they test: Multiple approaches — hash set, sorting, in-place marking.

Given an array where each element is 1 to n, find duplicates. Hash set is O(n) space; in-place marking (negating values at index positions) is O(1) space. Tests space optimization — a real concern with large datasets.

9. Maximum Subarray Sum (Kadane's Algorithm)

What they test: Dynamic programming basics, running sum logic.

Find the contiguous subarray with maximum sum. Kadane's algorithm tracks current sum, resets to 0 when negative. Gateway to DP — explain it clearly and interviewers may escalate to harder problems.

10. Check if a Binary Tree is Balanced

What they test: Recursion, height calculation, early termination.

Height difference of at most 1 between left and right subtrees at every node. Naive: O(n²). Optimized: return -1 when unbalanced, propagating early (O(n)). Tests recursive optimization.

11. Implement a Queue Using Two Stacks

What they test: Understanding of LIFO vs FIFO, data structure interconversion.

Use two stacks to simulate a queue. Push to stack1 for enqueue; for dequeue, transfer stack1 to stack2 if empty, then pop. Appears in InterviewBit's DSA interview list — tests deep understanding of data structure internals.

How to Prepare and Practice

Don't solve 500 random problems. Focus on patterns: arrays and hash maps (two sum, duplicates), linked lists (reverse, cycle detection), trees (traversal, balancing), and basic DP (Kadane's). About 110 targeted problems cover 90% of what Indian companies ask. Practice on paper first — many campus rounds are pen-and-paper.

Solving alone is different from solving while someone watches. Use PrepFox's mock interview platform to practice DSA under timed conditions with AI feedback. For the full interview process beyond DSA, see our interview preparation guide.

The Bottom Line

DSA interviews aren't about memorizing solutions — they're about recognizing patterns: when to use a hash map, two pointers, or recursion. Master these 11 questions and their patterns, and you'll handle 80% of DSA rounds at Indian companies. The remaining 20% are variations of the same patterns.

Start with arrays and linked lists this week. Don't skip to hard problems before you can explain the easy ones clearly — clarity matters as much as correct code in Indian interviews.

Ready to put this into practice?

Practice mock interviews, build your resume, and get expert feedback — all on PrepFox.