9 linked list interview questions, asked at Amazon, Google, Meta and 9 more companies. Last asked Oct 2026.
+5
Implement an LRU cacheCodingImplement a least-recently-used cache with get(key) and put(key, value), both in O(1) time, with a fixed capacity.
Last asked Oct 2026
+7
LRU cacheCodingBuild a key-value cache with a fixed capacity that evicts the least recently used entry when it is full. get(key) returns the value or a miss, put(key, value) inserts or updates…
Last asked Sep 2026
+1
Oldest one-time visitor in a login streamCodingAn online store wants to know which customers have visited only once. Every login is reported to your service as a username, in the order the logins happen. Implement a class…
Last asked Aug 2026
+1
Reconstruct a string from chained segmentsCodingA log-shipping service splits a long message into fragments and sends them out of order. Each fragment is a triple startid, endid, payload: it covers the stretch from marker…
Last asked May 2026
+1
LRU cache with runtime resizingCodingImplement a least recently used (LRU) cache whose capacity can change while it is in use. - get(key) returns the value for key, or -1 if it is not cached. A successful get makes…
Last asked Feb 2026
Thread-safe task queue on a linked listCodingA task queue was written for one thread: a singly linked list with head and tail, where put appends at the tail and get removes from the head. Explain what goes wrong when many…
Last asked Feb 2026
+1
Recent search history with a size limitCodingBuild the recent-searches list behind a search box. When the user focuses the box, it shows their most recent distinct searches, newest first. Every search the user runs is…
Route a request along diagonal server redirectsCodingServers sit at distinct integer points on an infinite 2D grid. locationsi = x, y is the position of server i. A request starts at server 0, which counts as visited. You are given…
Apply ordered token merges to a stringCodingMany language models read text as a list of token ids. In this scheme, every token after the single characters is built from two earlier tokens, and turning text into ids means…