Skip to content
PlacementSaathi

DSA Practice

DSA Practice Sheet for Campus Placements

Learn the pattern first, then solve problems in that pattern. Even a new interview question usually follows an old pattern. This sheet has 43 core problems across 11 patterns.

Problem sheet: search and filter

Type a problem name, or choose a pattern, difficulty and company. Clicking a problem opens the practice page in a new tab.

Showing 43 of 43 problems

  1. #1 · ArraysEasy
    Two Sum (opens in new tab)

    The journey from brute force to HashMap. The most common interview warm-up.

    TCSInfosysWiproAmazon
  2. #2 · ArraysEasy
    Best Time to Buy and Sell Stock (opens in new tab)

    Track a running minimum and solve it in one pass.

    TCSAccentureAmazon
  3. #3 · ArraysMedium
    Maximum Subarray (Kadane's Algorithm) (opens in new tab)

    Asked every season. The simplest form of DP.

    TCSInfosysCapgeminiAmazon
  4. #4 · ArraysMedium
    Product of Array Except Self (opens in new tab)

    Prefix and suffix products. Teaches you to think without division.

    Amazon
  5. #5 · Two PointersEasy
    Move Zeroes (opens in new tab)

    In-place array updates. A service-company coding round favourite.

    TCSWiproCapgemini
  6. #6 · Two PointersEasy
    Valid Palindrome (opens in new tab)

    Compare from both ends: strings and two pointers together.

    TCSInfosysAccenture
  7. #7 · Two PointersMedium
    Container With Most Water (opens in new tab)

    Which pointer to move? You must explain the greedy reasoning.

    AmazonInfosys
  8. #8 · Two PointersMedium
    3Sum (opens in new tab)

    Sort + two pointers + duplicate handling. Common in product interviews.

    Amazon
  9. #9 · Two PointersHard
    Trapping Rain Water (opens in new tab)

    The left-max / right-max classic. Builds Hard-level confidence.

    Amazon
  10. #10 · StringsEasy
    Valid Anagram (opens in new tab)

    Character frequency counting with a size-26 array.

    TCSWiproAccentureCapgemini
  11. #11 · StringsEasy
    Longest Common Prefix (opens in new tab)

    String comparison basics. Appears directly in online tests.

    TCSInfosys
  12. #12 · StringsMedium
    Longest Substring Without Repeating Characters (opens in new tab)

    Your entry to sliding window: grow and shrink a window with a set/map.

    InfosysAmazon
  13. #13 · StringsMedium
    Reverse Words in a String (opens in new tab)

    Split, trim and reverse. Tests how you handle extra spaces.

    TCSWiproCapgemini
  14. #14 · HashingEasy
    Contains Duplicate (opens in new tab)

    The most direct use of a HashSet. A two-minute question.

    TCSAccentureCapgemini
  15. #15 · HashingMedium
    Group Anagrams (opens in new tab)

    What should the map key be: a sorted string or a count signature?

    AmazonInfosys
  16. #16 · HashingMedium
    Top K Frequent Elements (opens in new tab)

    Frequency map + heap or bucket sort. A common follow-up.

    Amazon
  17. #17 · Sliding WindowEasy
    Maximum Average Subarray I (opens in new tab)

    A fixed-size window. The first step into sliding window.

    TCSWipro
  18. #18 · Sliding WindowMedium
    Minimum Size Subarray Sum (opens in new tab)

    A variable window: when to expand and when to shrink.

    InfosysAmazon
  19. #19 · Sliding WindowMedium
    Permutation in String (opens in new tab)

    Window + frequency match. The next level of anagrams.

    Amazon
  20. #20 · StackEasy
    Valid Parentheses (opens in new tab)

    The number one stack question. Shows up at almost every company.

    TCSInfosysWiproAccentureAmazon
  21. #21 · StackMedium
    Min Stack (opens in new tab)

    A design question: how do you keep the minimum in O(1)?

    AmazonCapgemini
  22. #22 · StackMedium
    Daily Temperatures (opens in new tab)

    Monotonic stack: the next greater element pattern.

    Amazon
  23. #23 · Linked ListEasy
    Reverse a Linked List (opens in new tab)

    Pointer reversal. Know both the iterative and recursive versions.

    TCSInfosysWiproCapgeminiAmazon
  24. #24 · Linked ListEasy
    Detect Cycle in a Linked List (opens in new tab)

    Floyd's slow-fast pointers. Also asked in viva rounds.

    InfosysAccentureAmazon
  25. #25 · Linked ListEasy
    Merge Two Sorted Lists (opens in new tab)

    The dummy node technique. The foundation of merge sort.

    TCSWiproAmazon
  26. #26 · Linked ListEasy
    Middle of the Linked List (opens in new tab)

    Find the middle in one pass. The simplest slow-fast use.

    TCSCapgeminiAccenture
  27. #27 · Linked ListHard
    Merge k Sorted Lists (opens in new tab)

    Heap + linked list. A product-company favourite Hard.

    Amazon
  28. #28 · TreesEasy
    Maximum Depth of Binary Tree (opens in new tab)

    Your first recursive tree question. Learn the base case.

    InfosysCapgeminiAmazon
  29. #29 · TreesEasy
    Invert Binary Tree (opens in new tab)

    Swap left and right. Builds recursion confidence.

    AccentureAmazon
  30. #30 · TreesMedium
    Binary Tree Level Order Traversal (opens in new tab)

    BFS with a queue. The template for many tree problems.

    InfosysAmazon
  31. #31 · TreesMedium
    Lowest Common Ancestor of a BST (opens in new tab)

    Use the BST property to decide: go left or right.

    Amazon
  32. #32 · GraphsEasy
    Flood Fill (opens in new tab)

    DFS on a grid. The easiest door into graphs.

    InfosysAmazon
  33. #33 · GraphsMedium
    Number of Islands (opens in new tab)

    Connected components. Very common at product companies.

    AmazonInfosys
  34. #34 · GraphsMedium
    Rotting Oranges (opens in new tab)

    Multi-source BFS: counting time as levels.

    Amazon
  35. #35 · GraphsMedium
    Course Schedule (opens in new tab)

    Cycle detection + topological sort. Directed graph basics.

    Amazon
  36. #36 · Dynamic ProgrammingEasy
    Climbing Stairs (opens in new tab)

    Fibonacci-style DP. Go from recursion to a table.

    TCSInfosysAccentureAmazon
  37. #37 · Dynamic ProgrammingMedium
    House Robber (opens in new tab)

    Pick / not-pick DP. Many later problems build on this.

    InfosysAmazon
  38. #38 · Dynamic ProgrammingMedium
    Coin Change (opens in new tab)

    A form of unbounded knapsack: find the minimum coins.

    InfosysAmazon
  39. #39 · Dynamic ProgrammingMedium
    Longest Increasing Subsequence (opens in new tab)

    O(n²) DP with an O(n log n) follow-up. Know both.

    Amazon
  40. #40 · Binary SearchEasy
    Binary Search (opens in new tab)

    low, high, mid. Boundary mistakes happen most here.

    TCSWiproCapgeminiAccenture
  41. #41 · Binary SearchMedium
    Search in Rotated Sorted Array (opens in new tab)

    Spotting which half is sorted is the whole problem.

    InfosysAmazon
  42. #42 · Binary SearchMedium
    Find Minimum in Rotated Sorted Array (opens in new tab)

    Find the rotation point. Companion to the problem above.

    Amazon
  43. #43 · Binary SearchMedium
    Koko Eating Bananas (opens in new tab)

    Binary search on the answer. A new way of thinking.

    Amazon
Company tags mean that questions on this pattern are commonly reported in that company's tests or interviews. The exact questions change every season, so master the pattern instead of memorising questions.

DSA patterns in one line each

Service companies test easy to medium levels. Product companies go up to Trees, Graphs and DP.

The Saathi Method

The right way to practise DSA

  1. 1

    Learn the pattern first

    Read the pattern idea for 5 minutes, then solve the problems in that pattern.

  2. 2

    Start with brute force

    Write whatever works first, state its time complexity, then move towards the optimal solution.

  3. 3

    Solve out loud

    Interviews expect you to explain your thinking. Say your approach out loud while you practise.

  4. 4

    Star it, then revise

    If a problem takes more than 30 minutes, study the solution and star it. Redo only starred problems at the end of the week.

How much per day? In Phase 1, 2-3 easy problems a day. From Phase 2, 1-2 medium problems plus 1 revision. The full plan is in the 90-Day Roadmap.

Your next step

Practise aptitude alongside DSA

Aptitude is the gatekeeper before the coding round. Do 20 timed questions today.