Topic
Data Structure Design interview problems
Caches, iterators, rate limiters and custom containers. 737 original problems, each with hidden test cases you can run in the browser.
53 easy587 medium97 hard
Showing 151–180 of 737 results
Design and implement a deterministic subword encoder that uses a trie for longest-match lookup, with lossless Unicode handling, versioned vocabularies, tests, and a comparison with BPE and WordPiece.
Model answertrietokenizerunicodenlpSimulate a job runner where resubmitting an ID overrides its earlier entry, testing heap-based lazy deletion with tie-breaking and run-once rules.
Auto-gradedheaplazy-deletionsimulationhash-mapBuild a Compose feedback form with a 1-5 star selector, a capped comment field and an async submit, driven by a single ViewModel state stream that survives rotation and double taps.
Model answerkotlinjetpack-composeandroidmvvmDesign a command-based history for a spreadsheet that undoes and redoes cell edits, row deletions and batches, recomputes dependent formulas, handles irreversible actions, and bounds memory.
Model answercommand-patternundo-redomementodependency-graphMaintain distinct-contact counts for users from undirected messages, answer the top user in O(1), and return a top-k list with deterministic tie-breaking.
Auto-gradedhash-sethash-mapheapsimulationReview a promise-coalescing TTL cache in TypeScript, find its failure, invalidation and memory bugs, write a fixed version, and explain how to port it safely to multithreaded C++20.
Model answerasynccacherace-conditionslruImplement an in-memory key-value database supporting GET, SET, DELETE, and nested transaction semantics (BEGIN, ROLLBACK, COMMIT).
Auto-gradeddesign-dsstacks-queuesarraysstringsSimulate a path-keyed tree store by replaying a list of commands, testing trie or hash-map design, path validation, and exact failure semantics.
Auto-gradeddesigntriehash-mapsimulationDesign a per-symbol price store supporting lookups, custom change formulas, atomic range updates that can touch each slot only once, and a switch from daily to hourly data.
Model answerdata-structure-designtime-seriesatomic-updateshash-mapSimulate a best-fit extent allocator over a huge block range, where reserve and release must merge adjacent free runs and run in logarithmic time.
Auto-gradeddesignordered-settreapcoalescingProcess a batch of lock, unlock and query operations on a rooted tree where no locked node may be an ancestor or descendant of another, using subtree ranges and Fenwick trees.
Auto-gradedtreeeuler-tourfenwick-treedesignSimulate a command-driven in-memory file store with ownership, per-user quotas, prefix/suffix search, quota-driven eviction and size-changing renames.
Auto-gradeddesignhash-mapsimulationsortingDesign and implement a versioned, checksummed binary format that converts a nested key-value map to bytes and back, and compare it with JSON and MessagePack.
Model answerserializationbinary-formatchecksumversioningDesign a data structure that supports adding, removing, and efficiently querying sentences by keyword in real time.
Model answerData Structure DesignInverted IndexStringHash TableSimulate a per-key sliding-window throttle over a batch of timed requests, tracking only accepted requests and handling window-boundary expiry correctly.
Auto-gradedsliding-windowdequehash-mapsimulationSimulate mutation and snapshot iteration on a persistent set structure using interval-based logical timestamps.
Auto-gradeddesign-dsarraysdata-structuresDesign and build a React component that ingests a real-time event stream, aggregates stats per category, handles out-of-order timestamps, and throttles re-renders for high throughput.
Model answerreactdata-structuresstreamingperformanceSimulate file system operations while maintaining deduplicated content storage using reference counting.
Auto-gradeddesign-dsarraysstringsTwo short coding tasks: build a fixed-size store that drops the least recently touched key in constant time, and pair up participants from a CSV so nobody draws themselves.
Model answerlru-cachehash-mapdoubly-linked-listderangementRead a move-only C++ class that owns a heap array, write a clean example program that uses it correctly, and explain the ownership, move, noexcept, explicit and const rules behind it.
Model answercppraiimove-semanticsrule-of-fiveSimulate an N x N, M-player connect-K game with turn order, move validation, win detection from the last move, board snapshots and undo.
Auto-gradedsimulationgriddesignundoSimulate a command log against a stateful tracker that merges per-agent time intervals and ranks agents by average rating with alphabetical tie-breaking.
Auto-gradeddesignintervalshash-mapsortingSimulate a tree-shaped registry addressed by slash-separated paths, processing a batch of create, set, get and remove commands and returning one result per command.
Auto-gradedtriehash-mapdesignstring-parsingDesign and implement an in-memory storage manager supporting CRUD operations, custom identifier parsing, case-insensitive uniqueness, and controlled renames.
Model answerdesign-dsarraysstringsSimulate a tail-only text buffer with undo and redo histories, recording only edits that change the text and clearing redo on every new edit.
Auto-gradeddesignstacksimulationundo-redoTurn an async sequence of arbitrarily split byte chunks into complete frames, each preceded by a 4-byte big-endian length, while handling truncation and oversized lengths.
Model answerstreamingstate-machineasyncbinary-parsingBuild a thread-safe buffer that accepts records from many producers and writes them to a database in batches, triggered by size, age of the oldest record, or shutdown, without holding locks during I/O.
Model answerconcurrencycondition-variablesbackpressurebatchingDesign a generic, thread-safe C++ queue where consumers block when it is empty and a shutdown call releases every waiting thread once the remaining items are drained.
Model answercppconcurrencymutexcondition-variableThree short design-and-code tasks: a key-value store with per-entry lifetimes and background pruning, an action history with undo/redo, and a depth-first walk over a hierarchy.
Model answercachettlmin-heapundo-redoDesign a slideshow widget plus per-photo comment threads with idempotent voting and fast top-k ranking, scaling to 10^5 photos and 10^6 comments.
Model answerdata-structure-designsorted-indexidempotencypagination