DEV Community

Cover image for 30 DSA Problems I’d Practice Before a FAANG Interview
Emily Woods
Emily Woods

Posted on Originally published at Medium Fully Autonomous

30 DSA Problems I’d Practice Before a FAANG Interview

One manageable daily routine, the patterns worth learning, and the follow ups that reveal whether you actually understand them.

30 DSA problems arranged into try, explain and revisit trays.

Saving another interview-prep list is wonderfully easy. Opening one problem after work and discovering that you cannot explain your own solution is considerably less fun.

Honestly, that second moment is where I want this list to help.

You do not need 30 problems competing for your attention every evening. You need a small set that makes you practice different decisions, then a reason to come back after the answer stops feeling familiar.

So I picked 30 problems across hashing, windows, intervals, stacks, search, trees, graphs and dynamic programming. Each one has a link, a specific lesson, and a check that makes copying the solution a little less comfortable.

This is my shortlist for building coding interview foundations, not a ranking of the questions FAANG asks most often. Company labels below reflect tags on the linked practice pages, rather than a promise about your interview.

Give one problem a proper 45 minutes

Start with five minutes on the contract. Write what comes in, what must come out, and which restrictions change the solution. Returning indices is different from returning values. Contiguous is different from merely keeping the original order.

Spend the next 25 minutes attempting and testing. Begin with an approach you can explain, even if it is slow, then identify exactly which work repeats. If you are stuck, take one small hint and record what it supplied.

Use 10 minutes to explain the decision behind your algorithm, including its time and space costs. Spend the last five recording one gap and scheduling another attempt.

45 minutes is a suggested practice session, not a deadline for mastering every problem. Minimum Window Substring may need another session, and that is completely fine.

A suggested 45-minute routine covering the contract, an attempt, an explanation and one recorded gap.

Start with information you can stop recomputing

1. Two Sum

Practice looking up the complement while retaining the original index. Check for a match before inserting the current item, so the same position cannot satisfy both sides. Try two equal values that form the target and explain why two distinct positions still matter.

Practice Two Sum.

2. Group Anagrams

Choose a representation that makes equivalent words share a key. A sorted string and a frequency tuple are both worth understanding. Your explanation should include the cost of building that key, rather than treating every dictionary operation as the entire algorithm.

Practice Group Anagrams.

3. Product of Array Except Self

Build the answer from what lies to the left and right of each position. Division is excluded, which makes this a lovely exercise in reusing partial results. Test one zero and then two zeros, and distinguish the output array from additional working space.

Practice Product of Array Except Self.

4. Subarray Sum Equals K

Count earlier prefix sums that would make the current segment total equal to k. Store frequencies, because the same prefix sum can appear repeatedly. Try negative numbers before reaching for a sliding window, and explain why an initial zero prefix must count once.

Practice Subarray Sum Equals K.

If Google is on your shortlist, take the prefix-sum idea into a different setting with overlapping flight bookings. Try recording where each booking starts and stops affecting the total, then reconstruct every flight’s reserved seats in one pass.

Try the Google tagged range booking question.

5. Google tagged practice: Longest Run of Distinct Characters

Keep a contiguous window with no repeated character. The useful question is how far its left boundary needs to move when a duplicate arrives, without ever moving backward.

Walk through abba before opening the solution. After the second b, the left boundary is already at index 2. When the final a arrives, its old position is outside the window, so moving left backward would reintroduce an invalid segment. That tiny example is doing serious work for us.

Try the Google tagged distinct character question.

The abba example shows why a sliding window’s left boundary must never move backward.

Make every pointer movement earn its place

6. 3Sum

Sort, fix one value, and search the remaining range with two pointers. Then explain how you prevent duplicate triplets without accidentally skipping a valid answer. Repeated zeros are a useful test, because a working sum calculation alone does not establish correct output.

Practice 3Sum.

7. Container With Most Water

This is a proof exercise wearing a short implementation. When the shorter side limits the height, moving only the taller side cannot improve the area while that shorter side stays fixed. Explain that reasoning before celebrating how few lines your code needs.

Practice Container With Most Water.

8. Minimum Window Substring

Expand until the window covers the required character counts, then shrink while it remains valid. Repeated characters in the target matter, so a set is insufficient. Keep this as a stretch problem and test a target containing two copies of the same letter.

Practice Minimum Window Substring.

Learn when ordering changes the whole problem

9. Merge Intervals

Sorting by start time makes it possible to reason about the next interval using the last merged result. Check nested intervals and touching endpoints under this problem’s rules. Updating the current end requires a maximum, because a smaller nested interval must not shorten it.

Practice Merge Intervals.

10. Insert Interval

Use the fact that the existing intervals are already sorted and non-overlapping. Separate the intervals before the new range, the overlapping middle, and the untouched remainder. This is a good moment to ask whether sorting again ignores a useful input guarantee.

Practice Insert Interval.

11. Non overlapping Intervals

Practice the greedy argument for keeping an interval that ends earlier, leaving room for later choices. Also check endpoint semantics here, because touching intervals can coexist. Carrying the overlap rule from the previous problem into this one is an easy mistake.

Practice Non overlapping Intervals.

12. Top K Frequent Elements

First count occurrences, then decide how to select the winners. Compare a size-k heap with frequency buckets and include the counting structure in your space analysis. Frequency ranking and numeric value ranking are different tasks, even when the examples look friendly.

Practice Top K Frequent Elements.

13. Kth Largest Element in an Array

A size-k min heap gives you a clear invariant to explain. Quickselect gives you a different trade-off, including expected versus worst-case running time. Duplicates count toward rank, so finding the kth distinct value would solve a different problem.

Practice Kth Largest Element.

14. Waymo tagged practice: Reorderable Tasks With a Cooldown

Tasks take one time unit, may be reordered, and may require idle time before the same type runs again. Begin by drawing a schedule, then reason about the most frequent task types and the gaps they force.

Pay attention to the time definition. Here the cooldown begins when a task finishes, so equal task types have start times at least cooldown + 1 apart. Compare repeated copies of one task with a balanced mixture before trusting a formula.

Try the Waymo tagged scheduling question.

Keep a precise meaning for the state you store

This is where a list becomes more useful than a collection of familiar titles. Ask what must remain true after every iteration. If the answer is vague, slow down before adding another condition.

Stacks retain unresolved items, binary search preserves a candidate interval, and backtracking restores state.

15. Valid Parentheses

Use the stack to remember opening brackets that still need matching. A closing bracket must match the most recent unresolved opening bracket, not simply any earlier one. Test a leading closing bracket and crossed nesting, then check that nothing remains unresolved at the end.

Practice Valid Parentheses.

16. Daily Temperatures

Keep indices whose warmer day has not arrived yet. When a warmer temperature appears, it resolves earlier entries and gives you their waiting distances. Explain why each index is pushed and popped at most once, despite the nested-looking loop.

Practice Daily Temperatures.

17. Binary Search

Choose a boundary convention and keep it consistent. An inclusive interval and a half-open interval need different updates. Test a missing target, a single element, and targets at both ends. Your explanation should make it obvious that the search range always shrinks.

Practice Binary Search.

18. Search in Rotated Sorted Array

Identify which half is sorted, then decide whether the target can belong there. The distinct-value assumption helps make that decision unambiguous. As a follow-up, think about what duplicates would do to the information gained from comparing the boundaries.

Practice Search in Rotated Sorted Array.

19. Koko Eating Bananas

Binary search can search for an answer, not only an array position. Define whether a given eating speed finishes within the allowed hours, then explain why increasing that speed cannot make a feasible answer infeasible. Use integer ceiling division when counting hours.

Practice Koko Eating Bananas.

Follow references without losing the structure

20. Reverse Linked List

Save the next node before changing the current node’s pointer. Draw three nodes and walk through every assignment, because a familiar loop can still disconnect the unprocessed suffix. Compare the iterative version’s extra space with the recursive call stack.

Practice Reverse Linked List.

21. Linked List Cycle

Use slow and fast pointers, then explain why their relative movement eventually produces a meeting inside a cycle. Compare node identity rather than stored values. Two different nodes holding the same value do not establish that a cycle exists.

Practice Linked List Cycle.

22. Binary Tree Level Order Traversal

Capture the queue size at the start of each level so newly added children belong to the next group. Explain why the queue can grow with the tree’s width. A balanced-looking example should not tempt you into claiming constant extra space.

Practice Level Order Traversal.

23. Validate Binary Search Tree

Carry constraints from ancestors instead of checking only a node’s immediate children. A value can satisfy its parent and still violate the root’s boundary. Draw that counterexample yourself, then make sure your implementation follows the strict ordering required by this problem.

Practice Validate Binary Search Tree.

24. Lowest Common Ancestor of a Binary Tree

Give each recursive return a clear meaning and explain what happens when the two targets are found on different sides. One target may itself be the ancestor. The original problem guarantees both nodes exist, so discuss the extra bookkeeping needed if that guarantee disappears.

Practice Lowest Common Ancestor.

For a harder Google-tagged tree exercise, switch from finding an ancestor to calculating every node’s total distance to the rest of a weighted tree. Work out what changes when you move the root across one edge, so you can reuse earlier calculations instead of traversing the whole tree again.

Try the Google tagged weighted tree challenge.

Explore possibilities without repeating everything

25. Number of Islands

Traverse a connected component and mark cells as visited when you discover them. Then continue scanning for unseen land. Explain whether you mutate the grid or keep a separate visited structure, and remember that a large component can make recursive depth a practical concern.

Practice Number of Islands.

26. Course Schedule

Represent prerequisites as directed edges and detect whether a cycle prevents completion. With indegrees, explain why processing every course means the dependencies can be satisfied. With DFS, distinguish a node currently on the recursion path from one already fully processed.

Practice Course Schedule.

If you are preparing for Amazon, carry this dependency reasoning into a recipe problem where ingredients can themselves be recipes. Missing supplies can block a recipe even without a cycle, so explain why your starting queue contains only ingredients that are actually available.

Try the Amazon tagged recipe dependency question.

27. Amazon tagged practice: Find Words in a Letter Grid

Start with one word, then extend the search to many words that may share prefixes. A trie can prune paths that cannot lead to any requested word, while backtracking manages the cells used on the current path.

Do not allow diagonal moves or reuse a cell within one word. Restore path state before exploring another branch, deduplicate matches, and return them in the sorted order required by this version. Those output rules deserve attention too.

Try the Amazon tagged word search question.

28. House Robber

Describe the best result available after considering a prefix of houses, then compare skipping the current house with taking it and excluding its neighbor. Write that state definition before the recurrence. Once it is clear, work out why only a small amount of previous state is needed.

Practice House Robber.

29. Coin Change

Build the minimum number of coins needed for each amount and represent unreachable amounts explicitly. Greedily taking the largest coin is not generally correct. Try denominations 1, 3 and 4 for an amount of 6, then explain why counting combinations would need a different state meaning.

Practice Coin Change.

30. Longest Increasing Subsequence

Begin with the quadratic DP solution so the state is understandable. Then study the faster tails approach and explain what each stored tail represents. That array is not necessarily the actual subsequence, so reconstructing an answer requires more information than returning its length.

Practice Longest Increasing Subsequence.

Make the second attempt count more than the first

Please do not turn this into a thirty-tab situation. We are trying to reduce the chaos a little.

Pick one unfamiliar problem for today and one previous problem to explain briefly from memory. Start with the earlier groups if your foundations feel shaky, and treat the harder extensions as separate sessions. Completing the list can take longer than thirty days because review belongs on the calendar too.

For each attempt, record whether you solved it independently, which hint you needed, the smallest failing input, and the decision you can now explain. That gives tomorrow’s session a useful starting point.

A review ladder moves from independent solving to explanation and adapting a changed requirement.

Try returning tomorrow, three days later, and a week later, adjusting that rhythm to what you actually remember.

Close the old solution first. Recreating code that is still open beside you mostly tests how carefully you can copy.

Once a problem feels comfortable, change one rule. Return a path instead of a count. Allow duplicate values. Remove the sorted input guarantee. Your first job is to notice which part of your reasoning no longer holds.

That is the progress I care about.

30 green checkmarks can look lovely, but being able to defend one decision when the question changes is much more useful in an interview.

Save this as a practice menu, choose today’s problem, and leave yourself one honest note for the next attempt. I’ll keep sharing the follow ups that turn familiar questions into better practice.

~ Emily

Top comments (0)