KatInterview

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

Coding Interview Problems

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

5978
Problems
2214
Auto-graded
15
Topics
272
Added today

Showing 2581–2610 of 2764 results

  • Data Structure DesignMediumModel answer
    Building Robust Autocomplete Query Management

    Design and implement the query-handling layer for an autocomplete component with debouncing, retry logic, response ordering, and result caching.

    Data Structure Designasynccachingstate-management
  • Data Structure DesignMediumModel answer
    Concurrent In-Memory Cache with Sharded Locking

    Build a thread-safe in-memory cache supporting concurrent reads and writes, choosing data structures and synchronization primitives to minimize contention.

    Data Structure Designconcurrencythreadinglockingdata-structures
  • Data Structure DesignMediumModel answer
    C++ Implementation Details: Containers and Polymorphism

    Explain the internal mechanics of std::vector growth, std::unordered_map collision handling, and virtual function dispatch in C++.

    Data Structure Designc++data-structuresperformancememory
  • Arrays & HashingEasyAuto-graded
    Combine Two Ordered Sequences

    Tests your ability to merge two pre-sorted arrays into a single sorted result using the classic two-pointer technique.

    Arrays & Hashingtwo-pointerssortingmerge
  • Arrays & HashingEasyAuto-graded
    Track Target Occurrence Patterns Across Array Regions

    Identifies whether a target value occurs at even/odd indices and in the first/second half of an even-length array in one pass.

    Arrays & Hashingarray-traversalboolean-flagsearly-termination
  • Data Structure DesignMediumModel answer
    Banking API with Thread-Safe Account Operations

    Build a thread-safe banking system supporting account creation, deposits, and transfers with atomic balance updates.

    Data Structure Designconcurrencythreadinglocksdata-structures
  • Math & Bit ManipulationMediumAuto-graded
    Calculate Ride Service Economics and Peak Pricing

    Tests unit economics, capacity planning, and dynamic pricing calculations for a transportation service with fixed driver costs and variable demand.

    Math & Bit Manipulationunit-economicscapacity-planningprofit-calculation
  • Trees & GraphsMediumAuto-graded
    Find All Downstream Dependents in a Dependency Graph

    Tests graph traversal with edge reversal to find all nodes reachable through reversed dependency edges, handling cycles correctly.

    Trees & Graphsgraph-traversalbfsdirected-graphcycle-detection
  • Heaps, Sorting & SearchMediumAuto-graded
    Count Valid Number Triplets Within Range

    Find how many ways to pick three numbers from an array where the maximum minus the minimum stays within a given threshold.

    Heaps, Sorting & Searchsortingtwo-pointerscombinatorics
  • Arrays & HashingEasyAuto-graded
    Apply Range Paint Operations and Count Final Colors

    Tests ability to use difference arrays to efficiently apply multiple range-update operations and decode the final state.

    Arrays & Hashingarraysdifference arrayprefix sumshashing
  • Data Structure DesignMediumModel answer
    Build Iterator Abstractions and Composed Traversals

    Design an iterator protocol from scratch, implement concrete iterators with different traversal logic, and extend them with features like peeking, filtering, and flattening.

    Data Structure Designiteratorsinterface-designlazy-evaluation
  • Data Structure DesignMediumModel answer
    Fix a Ride Dispatch Selection Bug

    Reproduce and fix a bug causing incorrect driver-to-order matching in a delivery assignment service.

    Data Structure Designdebuggingtestingconcurrencydistributed-systems
  • Data Structure DesignMediumModel answer
    Build a Concurrent Batch Transform Engine with Error Isolation

    Create a worker-pool-based processor that applies transformation pipelines to 2D integer grids, ensuring failures in individual items don't affect others.

    Data Structure Designconcurrencyerror-handlingthreading
  • Greedy & IntervalsMediumAuto-graded
    Minimum Deletions to Remove Half the Elements

    Tests greedy selection by frequency: choose the fewest distinct values whose total occurrences cover at least half the array.

    Greedy & Intervalsgreedyhashingsorting
  • Trees & GraphsMediumAuto-graded
    Find Build Order With Optional Priorities

    Tests whether a candidate can produce a valid topological ordering of task dependencies while breaking ties by smallest task ID for determinism.

    Trees & Graphsgraphstopological sortBFSKahn's algorithm
  • Stacks & QueuesEasyAuto-graded
    Validate Nested Tag Pairs in a Markup String

    Tests whether candidates can simulate bracket-matching logic with named tags, enforcing strict open/close pairing and proper nesting order.

    Stacks & Queuesstacksbracket matchingparsingsimulation
  • Arrays & HashingMediumAuto-graded
    Population Size from Two-Sample Overlap

    Apply the capture-recapture estimator to infer total population size from overlapping detection counts.

    Arrays & Hashingstatisticsestimationprobability
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Profit from Two Stock Transactions

    Tests dynamic programming with state transitions to find optimal profit from up to two non-overlapping buy-sell trades given daily stock prices.

    Dynamic Programmingarraysstate-machineoptimization
  • Heaps, Sorting & SearchMediumAuto-graded
    Unique Element Count in Sorted Array with Binary Search

    Tests efficient counting of distinct values in a sorted array using binary search to skip duplicate runs, achieving better than linear time complexity.

    Heaps, Sorting & Searchbinary-searcharraysoptimization
  • Heaps, Sorting & SearchMediumModel answer
    Binary Search Optimization and Interval Consolidation

    Find the minimal rate to process items within a time limit, then consolidate overlapping ranges into non-overlapping spans.

    Heaps, Sorting & Searchbinary-searchintervalsgreedyoptimization
  • Greedy & IntervalsMediumAuto-graded
    Fill Bag with Maximum Value from Identical-Weight Items

    Tests greedy optimization when all items have uniform weight, requiring recognition that standard knapsack DP is unnecessary and handling large counts efficiently.

    Greedy & Intervalsgreedysortingoptimization
  • Data Structure DesignMediumAuto-graded
    Key-Value Store with Expiration and Snapshots

    Design a nested dictionary with field-level expiration times and the ability to capture and restore database snapshots.

    Data Structure Designhash-tablesimulationdata-structure-design
  • Arrays & HashingMediumAuto-graded
    Event Log Analysis: Distinct Users and Session Duration

    Tests grouping, deduplication, and timestamp arithmetic over semi-structured event records.

    Arrays & Hashinggroupingaggregationtimestampsdata-wrangling
  • Dynamic ProgrammingHardAuto-graded
    Peak Subsequence Maximum Sum

    Tests dynamic programming with coordinate compression and Fenwick trees to efficiently compute optimal bitonic subsequences.

    Dynamic Programmingdynamic-programmingfenwick-treecoordinate-compressionbitonic-sequence
  • Dynamic ProgrammingHardAuto-graded
    Minimum-Cost Path with Fuel Stops on a Grid

    Tests grid DP with an extra state dimension: navigate an N×M grid from top-left to bottom-right tracking remaining fuel, refueling at marked cells, minimizing total toll cost.

    Dynamic Programmingdynamic programminggridstatememoization
  • Arrays & HashingMediumModel answer
    Chess Queen Line-of-Sight Attack Counting

    Calculate how many chess queens can attack each query position, first without obstacles, then accounting for blocking pieces on the board.

    Arrays & Hashinggeometryhash-mapbinary-searchsorting
  • Arrays & HashingMediumAuto-graded
    Ride Service Demand Under Weather Conditions

    Apply the Law of Total Probability and Bayes' Theorem to compute ride request likelihoods and conditional weather probabilities.

    Arrays & Hashingprobabilitybayes-theoremconditional-probability
  • Dynamic ProgrammingHardAuto-graded
    Path Sum with Conditional Prime Shortcuts

    Tests dynamic programming with number theory constraints, combining sequential traversal with prime-offset jumps that depend on target cell properties.

    Dynamic Programmingdynamic-programmingnumber-theoryarrays
  • Math & Bit ManipulationEasyAuto-graded
    Smallest Integer Divisible by All in Range

    Tests understanding of LCM computation via repeated GCD to find the least positive integer divisible by every integer in a given range.

    Math & Bit Manipulationmathnumber-theorygcd-lcm
  • Stacks & QueuesHardAuto-graded
    Evaluate a Ternary-Chained Arithmetic Expression

    Tests expression evaluation using a monotonic/operator-precedence stack to correctly parse and compute a string containing +, -, *, /, parentheses, and nested ternary operators.

    Stacks & Queuesstacksexpression evaluationparsingmonotonic stack