KatInterview

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

Coding Interview Problems

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

5986
Problems
2219
Auto-graded
15
Topics
271
Added today

Showing 361–390 of 651 results

  • Data Structure DesignMediumModel answer
    Finish a REST Resource: Update and Delete Routes in FastAPI

    Extend a small FastAPI service with replace and remove routes that follow existing conventions, handle idempotency and errors correctly, and ship with a full test suite.

    Data Structure Designfastapirest-apipydantichttp-status-codes
  • Trees & GraphsHardModel answer
    Rewrite a Relational Plan: Sink Filters and Trim Columns

    Transform a tree of Scan, Filter, Project and Join operators by moving filters toward the leaves and removing unused columns, while keeping query results unchanged.

    Trees & Graphstree-rewritingquery-optimizationpredicate-pushdownprojection-pruning
  • Data Structure DesignMediumModel answer
    Build a Dependency-Aware Cell Calculator with Cycle Checks

    Design an in-memory grid of numeric and formula cells in Python, reject circular dependencies, allow shared references, and compare lazy evaluation against eager recomputation with caching.

    Data Structure Designdesigngraphcycle-detectionmemoization
  • Stacks & QueuesMediumModel answer
    Evaluate Prize-Pool Formulas with Strictly Positive Whole Steps

    Parse and evaluate an infix arithmetic string, rejecting it with False if any intermediate result is zero, negative, or a non-integer quotient.

    Stacks & Queuesparsingrecursive-descentexpression-evaluationvalidation
  • Greedy & IntervalsMediumModel answer
    Busiest Stretches of a Garage from Gate Scanner Records

    Use unsorted gate scan records to find peak car occupancy and the maximal time windows at that peak, including when some exit scans are missing and stays are capped.

    Greedy & Intervalssweep-lineintervalsevent-processingsorting
  • Trees & GraphsMediumModel answer
    Count All Valid 4×4 Three-in-a-Row Game Sequences

    Use recursion and backtracking to enumerate every ordered move sequence on a 4×4 board where three consecutive marks (not four) wins.

    Trees & Graphsbacktrackingrecursiongame-treecombinatorics
  • Heaps, Sorting & SearchMediumModel answer
    Minimum-Distance Depot Placement on a Grid with Blocked Cells

    Place a depot on a 2D integer grid to minimize total Manhattan distance to all warehouses, avoiding any cell occupied by an obstacle.

    Heaps, Sorting & Searchmanhattan-distancemedianpriority-queueprefix-sums
  • Data Structure DesignMediumModel answer
    Build a Task Registry and Content-Based Duplicate Finder

    Design an in-memory task manager with per-user quotas, priority ordering and audit trails, then detect duplicate files using size filtering and streaming hashes.

    Data Structure Designhash-mapssorted-containersfilesystemhashing
  • Heaps, Sorting & SearchHardModel answer
    Identify Hidden Conflict with Minimal Oracle Queries

    Find one conflicting pair among n items using a black-box oracle that tests subsets, minimizing the number of expensive queries.

    Heaps, Sorting & Searchbinary-searchoptimizationoracleinformation-theory
  • Data Structure DesignMediumModel answer
    Build a Configurable Disc-Drop Game Engine

    Design and implement a gravity-based four-in-a-row game engine with a clean API, local win detection, and support for arbitrary board sizes and run lengths.

    Data Structure Designgame-engineapi-design2d-arraywin-detection
  • Data Structure DesignMediumModel answer
    Build a Slash-Command Router with Literal and Wildcard Segments

    Implement a trie-based router that matches tokenized bot commands to registered handlers, resolving conflicts between exact and parameterized path segments.

    Data Structure Designtrieroutingdesignstring-parsing
  • Dynamic ProgrammingMediumModel answer
    Fewest Transfers to Clear Everyone's Net Balance

    Given payer/payee/amount triples, compute net balances and return an optimal (minimum-count) set of settlement transfers that zeroes everyone out.

    Dynamic Programmingbitmask-dpgreedysubset-sumaccounting
  • Data Structure DesignMediumModel answer
    Build a POS cart with live receipt printing and combo deals

    Design a point-of-sale cart that prints an itemized receipt on every tap and then extends to apply non-overlapping combo discounts after each update.

    Data Structure Designdata-structuressimulationgreedy
  • Stacks & QueuesMediumModel answer
    Group Deletion Stack and Boundary Path Collection

    Remove consecutive identical-character groups from a string and collect a binary tree's boundary nodes in a specific mirror order.

    Stacks & Queuesstackbinary-treestring-manipulationrun-length-encoding
  • Data Structure DesignMediumModel answer
    Rolling-Window Key-Value Store with Live Average

    Design a key-value store that expires entries older than a configurable time window and supports O(1) average-case get, put, and average queries.

    Data Structure Designhash-maplinked-listsliding-windowamortized-analysis
  • Stacks & QueuesMediumModel answer
    Compute Per-Function Runtimes from a Profiler Event Log

    Parse a time-ordered sequence of START/END events, compute inclusive and exclusive runtimes per function, and identify the most expensive function by self-time.

    Stacks & Queuesstacksimulationprofilingcall-stack
  • Trees & GraphsMediumModel answer
    Currency Conversion Rates via Graph Traversal

    Build a weighted graph from currency pairs and answer conversion queries, then extend to directional rates and arbitrage detection.

    Trees & Graphsgraph-traversalshortest-pathbellman-fordfloating-point
  • Data Structure DesignHardModel answer
    Thread-Safe Queue with Lease-Based Message Visibility

    Design an in-memory queue that delivers messages with time-limited leases, validates acknowledgments against current lease tokens, and rejects duplicate entries.

    Data Structure Designconcurrencyqueuestate-machineidempotency
  • Arrays & HashingMediumModel answer
    Test Plan for Straight-Line vs Path Word Search

    Build a TDD plan, concrete cases, property invariants and stress tests for two grid word-search functions that must disagree on key inputs.

    Arrays & Hashingtestingtddgridsbacktracking
  • Data Structure DesignMediumModel answer
    Classic Data-Structure Drills: Cache, Trie, Heaps, Graphs

    Work through fifteen core algorithm patterns—LRU cache, trie, two-pointers, sliding window, topological sort, and more—naming invariants before coding.

    Data Structure Designhash-tablestwo-pointerssliding-windowgraphs
  • Arrays & HashingMediumModel answer
    Splitting Strings and Batching Equal-Cost Item Pairs

    Count splits where prefix and suffix share more than k letters, then find the target cost that yields the most single-or-pair packages.

    Arrays & Hashingcountingfrequency-arrayshash-mapcombinatorics
  • Arrays & HashingMediumModel answer
    Column-Normalize a Random Binary Matrix

    Generate an n×n matrix of fair coin-flip entries and rescale each column so its values sum to 1, in O(n²) time.

    Arrays & Hashingnumpymatrixnormalizationvectorization
  • Data Structure DesignMediumModel answer
    Building an In-Memory Recipe Store with Search and Versioning

    Design an in-memory recipe system with CRUD, ingredient lookup, per-user attribution with sorting, and immutable version history that survives deletes.

    Data Structure Designobject-oriented-designin-memory-storeindexingaudit-history
  • Arrays & HashingMediumModel answer
    Circular Token Distribution on a Ring of Nodes

    Distribute k tokens clockwise across n nodes in a ring starting at a given index, returning each node's final count without simulating one token at a time.

    Arrays & Hashingarraysmathmodulo arithmetic
  • Data Structure DesignHardModel answer
    In-Memory Ledger with Timed Transfers and Account Consolidation

    Design an in-memory financial ledger supporting deposits, transfers, scheduled future payments, top-K spending rankings, and account merges with pending-payment reconciliation.

    Data Structure Designheaphash-mapschedulingunion-find
  • Data Structure DesignMediumModel answer
    Design an In-Memory Ledger with Transfers and Activity Ranking

    Build an in-memory account ledger in stages—create/deposit, transfer, top-N by activity—plus a command-string test harness with clear failure semantics.

    Data Structure Designobject-oriented-designhash-mapheaptest-harness
  • Data Structure DesignMediumModel answer
    Build a Flexible Validation Engine with Pluggable Rules

    Design a payroll validator that lets you plug in new checks without changing the core engine, using abstraction and priority-based execution.

    Data Structure Designobject-oriented-designdesign-patternsextensibility
  • Data Structure DesignMediumModel answer
    Bits, Cache Eviction, and Vertex Degrees: Fundamentals Under Pressure

    Explain two's-complement shifts, compare LRU vs LFU eviction with trade-offs, and derive in-degree query costs across graph representations.

    Data Structure Designbit-manipulationcachinggraphscomplexity
  • Arrays & HashingEasyModel answer
    Weighted Random Item Picker from Scratch

    Implement a function that draws one item from a list at random, where each item's selection probability is proportional to its given weight.

    Arrays & Hashingprobabilityprefix-sumbinary-search
  • Data Structure DesignMediumModel answer
    Build a Bank, Validate Passwords, and Evaluate Expressions

    Design a mini banking system, write a password strength checker with generator, and parse arithmetic expressions with full operator precedence.

    Data Structure Designhash-mapstackparsingsimulation