Memoization interview questions
Practice 8 questions on memoization. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
8 questions
- JavaScriptCoding exercise
Once
EASYImplement a function that wraps a callback so it runs at most one time and reuses that result thereafter.
15 minAmazonPractice - JavaScriptCoding exercise
useCounter II
EASYRewrite useCounter so the returned helpers keep stable identities across renders.
15 minPractice - AlgorithmsCoding exercise
Distinct Paths in Grid
MEDIUMImplement a function that counts the number of unique paths a robot can take from the top-left to bottom-right of an m by n grid.
25 minPractice - JavaScriptCoding exercise
Memoize
MEDIUMImplement a function that caches results of a single-argument function so repeat calls return instantly.
25 minAirbnb · Atlassian · Expedia +5Practice - JavaScriptCoding exercise
Memoize II
MEDIUMImplement a memoize helper that caches results for functions called with any number and type of arguments.
25 minAirbnb · Expedia · LinkedIn +3Practice - JavaScriptCoding exercise
Memoize III
MEDIUMExtend memoize with a custom key resolver and cache controls (.clear() and .delete(key)).
25 minPremium questionPractice - JavaScriptCoding exercise
Reselect Selectors
MEDIUMBuild memoized selectors that recompute only when their input selections change by reference.
25 minPractice - AlgorithmsCoding exercise
Segment Words
MEDIUMImplement a function that decides whether a string can be broken into a sequence of words from a given dictionary.
25 minAmazon · Google · Meta +1Practice