FDEInterviews logo
Practice tests · 37 questions

Coding & DSA: the practice test

Multi-part practical builds (in-memory DBs, rate limiters, parsers) plus the LeetCode-medium staples, calibrated to OpenAI/Anthropic practical screens and Meta/Palantir classics. This test drills exactly that: 12 easy, 10 medium and 15 hard questions, every one explained, every explanation linking into the worked material.

Set up your test
Topic
How confident are you feeling?
Questions
12 in this pool · about 7 min
Reveal answers
Sign in to startFree account · your questions rotate between takes

Sample questions, answered

easy · sample
Two Sum in O(n): as you scan the array once, what do you store, and what do you look up?
Store each value in a sorted list; binary-search the target minus value
Store value to index in a hash map; look up target minus current value before inserting
Store running prefix sums; look up whether any prefix equals the target
Store each index in a set; look up whether the complement's index exists

The one-pass idiom: for each element, ask 'have I already seen my complement?' via a hash map of value to index, then insert the current value. Checking before inserting elegantly handles duplicates and forbids using the same element twice. The sorted-list variant costs O(n log n) and loses original indices; prefix sums answer subarray questions, not pair questions. Interviewers use this warm-up to check the reflex that powers half of array problems: trade memory for a lookup so the inner loop disappears.

easy · sample
An LRU cache needs O(1) get and put. Why does it take a hash map AND a doubly linked list together?
The map stores the hottest entries while the doubly linked list holds the overflow set
Two structures provide redundancy if one becomes corrupted
The list alone suffices, but the map accelerates warm-up scans
The map finds nodes in O(1); the list reorders and evicts in O(1); either alone fails

Each structure covers the other's weakness. A hash map finds a key instantly but has no notion of order, so it cannot say who is least-recent. A doubly linked list maintains recency order and can unlink any node or drop the tail in O(1), but finding a node by key means walking it. Map-of-key-to-node plus list-of-nodes gives both: get looks up the node and moves it to the head; put inserts at head and evicts the tail on overflow. 'Doubly' matters: removal from the middle needs the previous pointer without a scan. This composite is the canonical example of combining structures to meet dual O(1) requirements.

Go deeper than the quiz

A practice test measures recall. The material it draws from teaches the reasoning: