Question Bank
Every question, one list
Sandboxed coding rounds that run against a hidden test suite, and written questions graded against a rubric — side by side, because when you are drilling a topic you want both.
Topicimplementation (105)system-design (24)hld (20)trees (11)distributed-systems (10)arrays-hashing (9)concurrency (9)graphs (9)binary-search (8)consistency (8)dp-1d (8)linked-list (8)reliability (8)storage (8)
Clear filters8 questions · browse by bank instead
- Linked List CycleWrite `has_cycle(head)` returning `True` when the list contains a cycle. A set of visited nodes works and costs O(n) memory. The expected answer is Floyd: a slow pointer moving one step and a fast oneasyCoderpad#implementation#linked-list
- Merge Two Sorted ListsWrite `merge_two_lists(a, b)` merging two ascending lists into one ascending list and returning its head. Splice the existing nodes rather than allocating new ones. [1,2,4] and [1,3,4] -> [1,1,easyCoderpad#implementation#linked-list
- Reverse Linked ListWrite `reverse_list(head)` returning the head of the reversed list. 1 -> 2 -> 3 becomes 3 -> 2 -> 1 Save the next node before you overwrite the current pointer, or the rest of the list is goneeasyCoderpad#implementation#linked-list
- Copy List with Random PointerEach node has a `next` and a `random` pointer that may target any node or `None`. Write `copy_random_list(head)` returning a deep copy: entirely new nodes, with the same structure. The difficulty is mediumCoderpad#implementation#linked-list
- LRU CacheImplement `LRUCache(capacity)` with `get(key)` returning the value or `-1`, and `put(key, value)`. When the cache is full, evict the least recently used entry. Both operations must be O(1). Neither smediumCoderpad#implementation#linked-list
- Remove Nth Node From End of ListWrite `remove_nth_from_end(head, n)` removing the nth node counted from the end, and returning the head. [1,2,3,4,5], n = 2 -> [1,2,3,5] Counting the length first and walking again is two passmediumCoderpad#implementation#linked-list
- Reorder ListWrite `reorder_list(head)` reordering the list in place to `first, last, second, second-last, ...`. Return nothing; modify the nodes. [1,2,3,4] -> [1,4,2,3] [1,2,3,4,5] -> [1,5,2,4,3] mediumCoderpad#implementation#linked-list
- Merge k Sorted ListsWrite `merge_k_lists(lists)` merging `k` ascending linked lists into one and returning its head. The input may contain empty lists. Merging them one at a time into an accumulator is O(n k) — say so, hardCoderpad#implementation#linked-list