KatInterview

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

Coding Interview Problems

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

6040
Problems
2237
Auto-graded
15
Topics
275
Added today

Showing 1591–1620 of 2790 results

  • 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
  • StringsMediumAuto-graded
    Count Character Mismatches Across All Palindrome Mirrors

    Tests the ability to reframe a quadratic substring enumeration into a pair-centric counting problem with geometric weight calculations.

    Stringscombinatoricsstring-algorithmsoptimization
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Expected Value from Sequential Uniform Draws

    Tests understanding of optimal stopping via backward induction and dynamic threshold computation.

    Dynamic Programmingoptimal-stoppingbackward-inductionexpected-value
  • 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
  • Trees & GraphsMediumAuto-graded
    Retrieve Kth Smallest Element from Array-Encoded BST

    Tests in-order traversal of a binary search tree encoded in parallel arrays, with early termination and iterative stack management.

    Trees & Graphsbinary-search-treein-order-traversaliterativestack
  • Math & Bit ManipulationMediumAuto-graded
    Minimize Expected Candidates with Position-Match Feedback

    Tests ability to model a greedy partitioning strategy using bitmask bucketing to minimize expected remaining candidates under green-only feedback.

    Math & Bit Manipulationgreedybitmaskhashing
  • 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
  • Trees & GraphsMediumAuto-graded
    Count Reachable Cell Clusters in a Grid

    Tests grid-based connected-components detection using flood-fill or DFS, covering neighbor connectivity, visited-state tracking, and iterative traversal.

    Trees & Graphsgraphsgriddfsconnected-components
  • Data Structure DesignMediumAuto-graded
    Train Line Fare System with Dynamic Routes and Weekend Pricing

    Tests object-oriented design, index lookups, dynamic data structure updates, and conditional pricing rules in a fare calculation system.

    Data Structure Designobject-oriented-designhash-mapsimulation
  • Arrays & HashingEasyAuto-graded
    Daily and Rolling Active User Counts with Zero-Fill

    Tests building a complete calendar spine, counting distinct daily users, and maintaining a 30-day rolling active-user window.

    Arrays & Hashinghash-mapsliding-windowdate-manipulation
  • Data Structure DesignMediumAuto-graded
    Tiered Cache with TTL and Priority Fallback

    Implement a hierarchical key-value cache with expiration times, priority-based lookups, and lazy eviction across multiple storage tiers.

    Data Structure Designhash-tableheapdata-structure-design
  • 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
  • Arrays & HashingHardAuto-graded
    Three-in-a-Row: Find the Winner on a 3×3 Grid

    Tests whether you can encode all win conditions for a 3×3 grid as data and apply a uniform check to identify a winning player.

    Arrays & Hashingarraysgame-theorysimulation
  • 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
  • Trees & GraphsMediumAuto-graded
    Fold and Prune an Arithmetic Expression Tree

    Tests recursive AST traversal by simplifying an arithmetic expression tree through constant folding and algebraic identity rules, including cascading rewrites.

    Trees & Graphstreesrecursionast
  • Greedy & IntervalsMediumAuto-graded
    Peak Activity Count from Time Intervals

    Tests sweep-line techniques for interval overlap detection, event aggregation at boundaries, and proper handling of half-open interval semantics.

    Greedy & Intervalsintervalssweep-linesortingevent-processing
  • Arrays & HashingEasyAuto-graded
    Closest Pair of Target Words

    Find the minimum index gap between any occurrence of two distinct words in a list using single-pass tracking.

    Arrays & Hashingarraystringsingle-passtwo-pointer
  • Math & Bit ManipulationMediumAuto-graded
    32-Bit Integer Product via Shift-and-Add

    Tests mastery of bitwise arithmetic, sign handling, two's-complement overflow semantics, and O(log n) shift-and-add multiplication without using * or /.

    Math & Bit Manipulationbit-manipulationmathoverflowtwo's-complement
  • StringsEasyAuto-graded
    Convert Integer to English Words

    Tests ability to decompose integers into groups and translate numeric values into properly formatted English text with correct scaling terms.

    Stringsrecursionmathstring-formatting
  • 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
  • Arrays & HashingMediumAuto-graded
    Find User Pairs with Enough Overlapping Interests

    Tests your ability to invert a membership index and use co-occurrence counting to efficiently find all pairs sharing at least k common items.

    Arrays & Hashinghash-mapsetsco-occurrenceinverted-index
  • 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
  • Arrays & HashingMediumAuto-graded
    Trim a Record List to a Token Budget with a Sliding Window

    Tests the sliding-window technique: conditionally compact a list of records to the longest contiguous run whose token sum fits a given budget.

    Arrays & Hashingsliding-windowarraystwo-pointers
  • 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
  • Stacks & QueuesHardAuto-graded
    Reconstruct Function Lifetimes from Periodic Stack Snapshots

    Tests ability to diff consecutive call-stack snapshots using longest-common-prefix analysis and stack unwinding to produce ordered START/END lifecycle events.

    Stacks & Queuesstacksimulationtwo-pointers
  • 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