KatInterview

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

Coding Interview Problems

Practice 5980 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.

5980
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 211–240 of 650 results

  • Data Structure DesignMediumModel answer
    Implement Dynamic Bitwise Masking and Uniform O(1) Set

    Construct an XOR string transformation function alongside an expected constant-time randomized container structure.

    Data Structure DesignArraysHash MapBit ManipulationDesign
  • Data Structure DesignMediumModel answer
    Build a Persistent Key-Value Shell with Tests and CI

    Design a single-class interactive key-value shell that saves to disk, handles bad input, logs errors, accepts new commands easily, and ships with unit tests, a README, and CI.

    Data Structure Designoopcliunit-testingpersistence
  • StringsEasyModel answer
    Find Unique Words Across Two Text Blocks

    Identify words that appear in either of two given text strings, but not in both, using symmetric set difference.

    Stringsstringsarraysset-operations
  • Stacks & QueuesMediumModel answer
    Build a Multi-Room Async TCP Chat Server

    Implement a concurrent, room-based TCP chat server in Python using asyncio, featuring command processing, scoped broadcasts, backpressure handling, and strict resource cleanup.

    Stacks & Queuesconcurrencyasyncionetworkingpython
  • Greedy & IntervalsMediumModel answer
    Peak Overlap Point, Bounded BST Sums, and Call-Stack Self Time

    Three separate tasks: find an integer with the highest interval overlap, sum BST values within a range (plus many-query speedups), and compute per-function self time from nested start/end logs.

    Greedy & Intervalssweep-linebstprefix-sumsstack
  • Data Structure DesignHardModel answer
    Expiring Resource Credit Ledger with Out-of-Order Events

    Design an in-memory compute credit ledger handling expiring grants, usage subtractions with earliest-expiration priority, out-of-order event ingestion, and point-in-time balance queries.

    Data Structure Designdesign-dsheaps-sortinggreedy-intervalsarrays
  • Data Structure DesignMediumModel answer
    Reconcile Cached Coverage Status with Out-of-Order Checks

    Build a reconciler that keeps a cached insurance status correct when verification results arrive late, duplicated, or as failures, and that can rebuild the status from full history.

    Data Structure Designidempotencyout-of-order eventscache consistencystate reconciliation
  • Data Structure DesignMediumModel answer
    Log Test Executions and Query Failure Recovery and Concurrent Failures

    Design an event-driven system to track test statuses, calculate minimum recovery durations, and identify the longest continuous window of high concurrent failures.

    Data Structure Designdesign-dsgreedy-intervalsarrays
  • Heaps, Sorting & SearchMediumModel answer
    Design a Single-Threaded Delayed Task Runner

    Implement a priority-queue task runner that handles delayed execution without busy-waiting.

    Heaps, Sorting & Searchheappriority-queuedesign-dstime-complexity
  • Heaps, Sorting & SearchMediumModel answer
    Design and Analyze an Intentionally Inefficient Correct Sorting Algorithm

    Propose a fully correct yet highly inefficient sorting algorithm, prove its termination and correctness, and derive its time and space complexity.

    Heaps, Sorting & Searchsortingcomplexity-analysiscombinatoricsrecursion
  • Data Structure DesignMediumModel answer
    Designing Dynamic Load Balancers: Round-Robin and Consistent Hashing

    Implement a resilient round-robin request balancer that handles dynamic server membership, followed by a consistent hashing router to maintain key affinity.

    Data Structure Designdesign-dshashingconcurrencybinary-search
  • Trees & GraphsMediumModel answer
    Build a Collapsible JSON Tree Renderer in React

    Design and implement a React component to display nested JSON with collapsible nodes, indentation, and syntax highlighting for primitive types.

    Trees & GraphsReactJSONTreeFrontend
  • Data Structure DesignMediumModel answer
    Refactoring and Hardening a Driver Dispatch Service

    Identify anti-patterns in legacy dispatch assignment code, implement fixes, introduce domain types, and design for thread-safety.

    Data Structure Designrefactoringthread-safetyobject-oriented-designclean-code
  • Dynamic ProgrammingHardModel answer
    Identify Compound Words in a Dictionary

    Find all strings in a list that can be constructed by concatenating two or more smaller strings from the same list.

    Dynamic Programmingstringsdynamic-programmingtriehash-table
  • Data Structure DesignMediumModel answer
    Build Stateful Round-Robin and Consistent Hash Load Balancers

    Implement thread-safe Round-Robin and Consistent Hashing balancers supporting health checks and dynamic nodes, then analyze their performance.

    Data Structure Designload-balancerconsistent-hashinground-robindata-structure-design
  • Greedy & IntervalsMediumModel answer
    Pinpoint Bad Nodes with Disjoint Group Probes of Size Two or More

    Find exactly which cluster nodes are bad when the only probe is a group test that fails if any member is bad, parallel probes must be disjoint, and each probe needs at least two nodes.

    Greedy & Intervalsgroup-testingadaptive-algorithmsround-robin-schedulingidentifiability
  • Stacks & QueuesMediumModel answer
    Evaluate Arithmetic Expressions and Decode Nested Run-Length Strings

    Implement two production-ready string parsers: an arithmetic evaluator supporting basic operators and precedence, and a nested string expansion utility.

    Stacks & Queuesstackparsingstringsexpression-evaluation
  • Data Structure DesignMediumModel answer
    Build an In-Memory Playlist Engine with a Three-Slot Favorites Set

    Design a thread-safe in-memory audio player with a queue, history, and a favorites list capped at three that rejects overflow deterministically rather than evicting.

    Data Structure Designdesigndequehash-mapconcurrency
  • Math & Bit ManipulationEasyModel answer
    Circle Point Generation, Strict Monotonic Run, and Histogram Interpolation

    Solve three foundational tasks: uniform random sampling within a disk, tracking the longest strictly increasing contiguous array, and computing bucketed percentiles.

    Math & Bit Manipulationsamplingarraysinterpolationmath
  • Data Structure DesignMediumModel answer
    Build a Plain-Text Notes REST API and Black-Box Test Plan

    Design a small CRUD HTTP service that accepts raw text bodies but replies in JSON, then explain how to test an unseen function from its specification alone.

    Data Structure Designrest-apihttp-status-codesunit-testingflask
  • Data Structure DesignMediumModel answer
    Efficient Large File Tailer and Sensor Heartbeat Monitor

    Read the last N lines of a huge file using reverse chunk seeking, and track active devices using an OrderedDict for fast sliding window health queries.

    Data Structure Designfile-iosliding-windowordered-dictsystem-design-ds
  • Math & Bit ManipulationMediumModel answer
    Cheapest Cart Total with Percent-Off and Buy-X-Get-Y Promotions

    Define pricing rules for percent-off and buy-X-get-Y promotions, then build an algorithm that returns the lowest legal total for a cart, covering stacking, repeats, and rounding.

    Math & Bit Manipulationpricingdiscountsrequirements-clarificationgreedy
  • Data Structure DesignHardModel answer
    Thread-Safe Idempotency Key Processor

    Design a thread-safe idempotency manager that executes tasks at most once per key, blocks concurrent callers, caches results with TTL, and cleans up expired records efficiently.

    Data Structure Designconcurrencycachingdesigndata-structures
  • Greedy & IntervalsMediumModel answer
    Smallest Vehicle Pool for Location-Bound Shuttle Runs

    Given timed runs between named stops, find the fewest shuttles needed when each shuttle can only continue from the stop where its previous run ended.

    Greedy & Intervalssweep-linesortingeventsgreedy
  • Data Structure DesignMediumModel answer
    Design a Spreadsheet Data Model with Dependent Cell Evaluation

    Design the internal data structures and API for a spreadsheet engine supporting raw inputs, computed values, dependency tracking, and formula evaluation.

    Data Structure DesignData Structure DesignGraphCachingDependency Tracking
  • Math & Bit ManipulationEasyModel answer
    Handling IEEE 754 Floating-Point Limits in JavaScript

    Understand JavaScript numeric edge cases, floating-point precision constraints, and how to safely implement custom checks without built-in helpers.

    Math & Bit Manipulationjavascriptieee-754numeric-precisiontype-coercion
  • Data Structure DesignMediumModel answer
    Design a Multi-Tenant Security Event Enrichment Engine

    Design and implement an in-memory pipeline to enrich telemetry events and evaluate dynamic suppression rules with multi-tenant scoping and fault tolerance.

    Data Structure Designdesignobject-orientedmulti-tenancypipelines
  • Arrays & HashingMediumModel answer
    Uniform Random Array Partitioning into K Segments

    Divide an array into K non-empty contiguous slices such that every valid partition is equally likely to be selected.

    Arrays & Hashingarraysmath-bitsheaps-sorting
  • Data Structure DesignMediumModel answer
    Design a Support Agent Dispatcher with Interruption Handling

    Design an in-memory dispatch engine that pairs queued support tickets with available agents, extended to handle mid-task agent breaks and fair ticket re-queuing.

    Data Structure Designdesign-dsstacks-queuesheaps-sorting
  • Data Structure DesignMediumModel answer
    Fix a Rotating Server Picker, Then Build a Hash Ring

    Find and fix the bugs in a round-robin server selector that handles pool changes and threads, then build a consistent-hash ring with virtual nodes that keeps key movement minimal.

    Data Structure Designload-balancingconsistent-hashingdebuggingconcurrency