6 memoization interview questions, asked at Airbnb, Amazon, Databricks and 3 more companies. Last asked Apr 2026.
Longest increasing path in a matrixCodingReturn the length of the longest path in an integer matrix that moves up, down, left or right and only to strictly larger values. Use memoised DFS (or a topological order) so…
Last asked Apr 2026
Lazy array with deferred map and indexOfCodingImplement LazyArray, an integer array that supports deferred mapping. Calls to map are recorded but do not run. The recorded functions run only when a query needs a value…
Last asked Apr 2026
Shortest path between two cells in a gridCodingGiven a grid with open and blocked cells, return the length of the shortest path from a start cell to a target cell moving up, down, left and right. A follow-up changes the…
Last asked Feb 2026
Word break II: every way to split a sentenceCodingGiven a string and a dictionary of words, return every sentence you can form by splitting the string into dictionary words, with words separated by spaces. Words may be reused…
Last asked Jan 2026
Winner of a stack-merging gameCodingTwo players take turns merging stacks according to the game's rules until no move is left. Given the starting stacks, decide which player wins if both play optimally. Start with a…
Last asked Jan 2026
Collatz sequence steps with memoized range maximumCodingStarting from a positive integer n, repeat the following until n equals 1: - If n is even, set n = n / 2. - If n is odd, set n = 3n + 1. Each replacement counts as one step. (It…