KatInterview

practice a little every day — you've got this ♡

Coding Interview Problems

Practice 5972 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.

5972
Problems
2212
Auto-graded
15
Topics
273
Added today

Showing 121–150 of 650 results

  • Heaps, Sorting & SearchMediumModel answer
    Batched API Delivery with Delay-Aware Retries

    Deliver a list of requests through an API capped at five per call, retrying failures only after each request's own cooldown, without busy-waiting or blocking on one failure.

    Heaps, Sorting & Searchbatchingretryschedulingpriority-queue
  • Data Structure DesignMediumModel answer
    Star Feedback Widget with Compose and a ViewModel

    Build 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.

    Data Structure Designkotlinjetpack-composeandroidmvvm
  • Data Structure DesignMediumModel answer
    Reversible Edit History for a Formula-Driven Grid

    Design 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.

    Data Structure Designcommand-patternundo-redomementodependency-graph
  • Data Structure DesignHardModel answer
    Hardening a Coalescing TTL Cache: Failures, Invalidation, Eviction

    Review 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.

    Data Structure Designasynccacherace-conditionslru
  • Trees & GraphsMediumModel answer
    Two Warm-Ups: One-Deletion Palindrome and Column-Grouped Tree Output

    Decide whether a string becomes a palindrome after removing at most one character, then group a binary tree's node values by column using level-order tie-breaking.

    Trees & Graphstwo-pointerspalindromebfsbinary-tree
  • Data Structure DesignMediumModel answer
    Build an In-Memory Price History Store with One-Shot Updates

    Design 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.

    Data Structure Designdata-structure-designtime-seriesatomic-updateshash-map
  • Data Structure DesignMediumModel answer
    Binary Wire Format for a Nested Key-Value Map

    Design 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.

    Data Structure Designserializationbinary-formatchecksumversioning
  • Data Structure DesignHardModel answer
    Design an In-Memory Sentence Search Index

    Design a data structure that supports adding, removing, and efficiently querying sentences by keyword in real time.

    Data Structure DesignData Structure DesignInverted IndexStringHash Table
  • Data Structure DesignMediumModel answer
    Real-Time Log Event Aggregation in React

    Design 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.

    Data Structure Designreactdata-structuresstreamingperformance
  • Arrays & HashingMediumModel answer
    Detect 8-Hour Cooling Streaks in a Flaky Forecast Feed

    Build a service that checks a city's latitude, pulls a 72-hour forecast from an unreliable API with proper retries, and returns every 8-hour span of strictly falling, gapless hourly temperatures.

    Arrays & Hashingsliding-windowretry-backoffapi-integrationerror-handling
  • Data Structure DesignEasyModel answer
    Recency-Evicting Store and Random Gift-Swap Pairing

    Two 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.

    Data Structure Designlru-cachehash-mapdoubly-linked-listderangement
  • Data Structure DesignEasyModel answer
    Show How to Use a Move-Only Heap Buffer in C++, and Defend It

    Read 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.

    Data Structure Designcppraiimove-semanticsrule-of-five
  • Arrays & HashingEasyModel answer
    Clean and Reconcile Account Snapshots from a JSON Feed

    Parse a JSON list of account records with exact decimal arithmetic, drop invalid rows, keep the newest record per account, and report a rounded total plus a per-account map.

    Arrays & Hashingpythonjsondecimaldeduplication
  • Trees & GraphsMediumModel answer
    Unify Contact Profiles Linked by Common Email Addresses

    Combine contact records that are directly or transitively linked by a shared email, outputting each person's name with a deduplicated, sorted email list.

    Trees & Graphsunion-findgraphconnected-componentsdfs
  • Heaps, Sorting & SearchMediumModel answer
    Fill Spare Slots and Sort One Buffer In Place

    Combine two unsorted integer lists into the first, which has spare room at its end, so it ends up fully ascending, without using placeholder values to locate the data.

    Heaps, Sorting & Searcharrayssortingin-placeheapsort
  • Data Structure DesignHardModel answer
    Design an In-Memory Recipe Storage Engine

    Design and implement an in-memory storage manager supporting CRUD operations, custom identifier parsing, case-insensitive uniqueness, and controlled renames.

    Data Structure Designdesign-dsarraysstrings
  • Arrays & HashingMediumModel answer
    Fix a Failing Budget-Check Module and Add Regression Tests

    Debug a small spending-limit module with failing tests: find root causes, fix them, add minimal regression tests, and explain your debugging process and tools.

    Arrays & Hashingdebuggingunit-testingroot-cause-analysisfloating-point
  • Data Structure DesignHardModel answer
    Reframing Chunked Async Reads into Length-Prefixed Frames

    Turn 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.

    Data Structure Designstreamingstate-machineasyncbinary-parsing
  • Data Structure DesignMediumModel answer
    Concurrent Micro-Batching Writer with Backpressure and Timed Flush

    Build 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.

    Data Structure Designconcurrencycondition-variablesbackpressurebatching
  • Data Structure DesignMediumModel answer
    Build a Shutdown-Aware Producer/Consumer Queue in C++

    Design 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.

    Data Structure Designcppconcurrencymutexcondition-variable
  • Heaps, Sorting & SearchMediumModel answer
    Exact Mode, Median and Balanced Sort Over Ten Message-Passing Nodes

    Integers live on ten machines that can only exchange messages. Write per-node programs for the exact mode, the median and a balanced global sort while sending as little data as possible.

    Heaps, Sorting & Searchdistributed-systemsmapreducesample-sortselection
  • Data Structure DesignMediumModel answer
    Expiring Store, Reversible Actions, and Org Chart Walk

    Three 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.

    Data Structure Designcachettlmin-heapundo-redo
  • Data Structure DesignMediumModel answer
    Photo Slideshow with Ranked Comment Threads and Safe Voting

    Design 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.

    Data Structure Designdata-structure-designsorted-indexidempotencypagination
  • Data Structure DesignEasyModel answer
    Python Tuples, Dict Internals, and Error Handling in a Record Store

    Answer three fundamentals questions: tuple rebinding and shallow immutability, how a hash table handles insert, lookup, update and delete, and where to raise and catch errors in a record class.

    Data Structure Designpythonimmutabilitytupleshash-table
  • Math & Bit ManipulationMediumModel answer
    Eight Number Puzzles: Spot the Rule, Predict the Next Value

    Work out the hidden rule behind eight short numeric and fractional sequences, state the next term for each, and justify it against every given term.

    Math & Bit Manipulationsequencespattern-recognitionrecurrence-relationsmental-math
  • StringsMediumModel answer
    Stream Data Processing with Early Cutoff on Sequence Detection

    Yield data from a continuous stream of string fragments, terminating immediately when a specific multi-character sequence is identified across fragment boundaries.

    Stringsstringssliding-windowtwo-pointerskmp
  • Trees & GraphsHardModel answer
    Fastest Route Through Only the Courses a Goal List Needs

    Given courses with durations, prerequisite links and a list of goal courses, compute the minimum time to finish the goals and their needed prerequisites, as total effort and as elapsed time.

    Trees & Graphsgraphtopological-sortdagcycle-detection
  • Data Structure DesignMediumModel answer
    Coalescing Single-Key Reads into Timed Batch Requests

    Build a callback-driven client that gathers individual key requests into one batched GET every 100 ms, using only a timer and an async HTTP primitive, while keeping overlapping batches isolated.

    Data Structure Designevent-loopbatchingcallbackstimers
  • Trees & GraphsMediumModel answer
    Build a Display Order for Tasks with Dedup, Filtering and Subtasks

    Turn a flat batch of scheduler tasks into a display list: merge duplicates, hide finished work, order by priority, and keep each subtask right under its parent.

    Trees & Graphssortinghashingtree-traversalcycle-detection
  • Trees & GraphsMediumModel answer
    Distributed Tree Traversal and Reliable Neighbor Messaging Protocol

    Design a reliable message passing protocol across adjacent tree nodes, then compute total network size and discover paths under network faults.

    Trees & Graphstrees-graphsdistributed-systemsmessage-passingnetwork-protocol