DSA Problem List
Java Backend Developer | TCS · Infosys · Accenture · Deloitte | 5–8 LPA
MUST-D
High priority — covers 70% of interview questions
O
EASY Beginner friendly — do these first
MEDIUM One step up — commonly asked in interviews
5 must-do / 10 total
01 Arrays — the foundation
Start here. 80% of OA questions touch arrays.
EASY
■ Two Sum
EASY
■ Best Time to Buy and Sell Stock
EASY
■ Maximum Subarray (Kadane's Algorithm)
EASY
■ Move Zeroes to end
EASY
■ Rotate Array by K places
EASY
■ Remove duplicates from sorted array
EASY
■ Find second largest element
EASY
■ Union and Intersection of two arrays
MEDIUM
■ Majority Element (Boyer-Moore)
MEDIUM
■ Product of Array Except Self
6 must-do / 10 total
02 Strings — very high frequency
Story problems love strings. Learn these patterns.
EASY
■ Reverse a string / words in a string
EASY
■ Check if string is palindrome
EASY
■ Check if two strings are anagrams
EASY
■ Count vowels and consonants
EASY
■ First non-repeating character
EASY
■ Longest common prefix
EASY
■ Valid parentheses (using stack)
EASY
■ String compression (aaabbc -> a3b2c1)
MEDIUM
■ Count and say problem
MEDIUM
■ Roman to Integer conversion
4 must-do / 6 total
03 HashMap — the secret weapon
Most story problems are secretly HashMap problems.
EASY
■ Frequency count of characters
EASY
■ Find duplicates in array
EASY
■ Two Sum using HashMap
MEDIUM
■ Group anagrams together
MEDIUM
■ Subarray with zero sum
MEDIUM
■ Longest consecutive sequence
3 must-do / 6 total
04 Sliding Window + Two Pointers
Solves 'longest / shortest / max' story problems.
MEDIUM
■ Longest substring without repeating characters
EASY
■ Maximum sum subarray of size K
MEDIUM
■ Minimum window substring
EASY
■ Remove duplicates using two pointers
MEDIUM
■ Container with most water
MEDIUM
■ 3Sum problem
2 must-do / 5 total
05 Binary Search — OA favourite
Appears in 40% of online assessments.
EASY
■ Binary search in sorted array
MEDIUM
■ First and last position of element
MEDIUM
■ Search in rotated sorted array
MEDIUM
■ Find peak element
EASY
■ Square root using binary search
3 must-do / 6 total
06 Stack & Queue
You know basics. Now do these patterns.
EASY
■ Valid Parentheses
MEDIUM
■ Next Greater Element
MEDIUM
■ Min stack (getMin in O(1))
EASY
■ Implement queue using two stacks
MEDIUM
■ Sliding window maximum (deque)
MEDIUM
■ Balanced parentheses generation
4 must-do / 6 total
07 Linked List
Usually 1 LL question per technical round.
EASY
■ Reverse a linked list
MEDIUM
■ Detect cycle in linked list (Floyd's)
EASY
■ Find middle of linked list
MEDIUM
■ Merge two sorted linked lists
MEDIUM
■ Remove Nth node from end
MEDIUM
■ Palindrome linked list check
1 must-do / 6 total
08 Recursion & Basic Math
Builds intuition. Needed for explaining solutions.
EASY
■ Fibonacci (recursive + iterative)
EASY
■ Factorial recursive
EASY
■ Power of a number (fast exponentiation)
EASY
■ Check prime number
EASY
■ Count digits, reverse digits
EASY
■ GCD and LCM
3 must-do / 5 total
09 Sorting — know when to use which
Know concepts, not just memorised code.
EASY
■ Bubble sort implementation
EASY
■ Selection sort implementation
MEDIUM
■ Merge sort (divide and conquer)
MEDIUM
■ Sort array of 0s, 1s, 2s (Dutch flag)
MEDIUM
■ Find kth largest element
Will this be enough to crack 5–8 LPA jobs?
Q: Which companies fall in 5–8 LPA range?
TCS (Digital/Ninja), Infosys (SP/DSE), Accenture, Deloitte, Capgemini, Wipro, Cognizant, HCL, L&T; Infotech,
Mphasis, Hexaware. Also startups and mid-size product companies at this range.
Q: Is this problem list enough for the coding rounds?
YES — for service-based companies and most 5–8 LPA roles, 100%. Their OA rounds use Easy to Easy-Medium
problems. These 55 problems cover every pattern that appears in those assessments. The must-do problems
alone (25 problems) cover 70% of what gets asked.
Q: What else is needed beyond DSA?
DSA is only one part. You also need: Core Java (OOP — inheritance, polymorphism, abstraction, interfaces),
Collections framework (ArrayList, HashMap, Stack, Queue), Basic SQL (SELECT, JOIN, GROUP BY, subqueries),
1–2 personal projects to discuss, and OS/Networking basics (only for some companies like Deloitte).
Q: What about story-type questions?
Story questions are pattern problems in disguise. After finishing sections 3 (HashMap) and 4 (Sliding Window),
practice translating 5 story problems per day from GFG before coding them. The translation skill develops in 1–2
weeks and makes story questions feel easy.
Q: Honest timeline to be ready?
6 weeks of consistent 1.5–2 hrs/day practice is enough. Week 1–2: Arrays + Strings + HashMap. Week 3: Binary
Search + Two Pointers + Sliding Window. Week 4: Stack/Queue + Linked List + Recursion. Week 5–6: Mixed
practice + OA mock tests on HackerRank and GFG.
Q: Where to practise?
LeetCode (filter by Easy, then do topic-wise). GFG — search 'TCS coding questions GFG' and 'Infosys coding
questions GFG' for company-specific sets. HackerRank for Java-specific OA simulation.
Total: 55 problems | Must-do: 25 problems | Easy: 28 | Medium: 27