KatInterview

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

Coding Interview Problems

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

6037
Problems
2236
Auto-graded
15
Topics
273
Added today

Showing 1621–1650 of 2789 results

  • Data Structure DesignHardAuto-graded
    Policy-Driven Spending Report Checker

    Tests whether a candidate can implement a multi-scope rule evaluation pipeline that collects all violations across item-level, aggregate, and relational policy checks.

    Data Structure Designobject-oriented designopen-closed principledata aggregation
  • 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 & HashingMediumAuto-graded
    Track Items Surviving Sequential Shifts on a Grid

    Determine which grid cells remain in bounds after a sequence of directional shifts, testing displacement tracking and boundary analysis.

    Arrays & Hashingsimulation2d-arrayprefix-summath
  • Arrays & HashingMediumAuto-graded
    Momentum-Weighted Portfolio: Daily Log Return Statistics

    Tests simulation of a daily rebalancing strategy where portfolio weights are proportional to positive asset returns, requiring correct timeline logic and statistical output.

    Arrays & Hashingsimulationfinancestatistics
  • 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
  • Arrays & HashingMediumAuto-graded
    Overlapping 2D Block Move with O(1) Extra Memory

    Tests whether a candidate can copy a rectangular subregion of a 2D grid onto another position in the same grid, in place, without corrupting overlapping data.

    Arrays & Hashingarraysin-placetwo-dimensional
  • 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
  • Dynamic ProgrammingHardAuto-graded
    Cheapest Round-Trip Inspection Tour

    Tests bitmask dynamic programming (Held–Karp) to find the minimum-cost Hamiltonian cycle in a small directed weighted graph.

    Dynamic Programmingbitmask-dptraveling-salesmangraphs
  • 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
  • Arrays & HashingMediumAuto-graded
    Shortest Window With Unique-Value Sum Meeting a Goal

    Sliding-window task where the window score is the sum of its distinct values, not the plain sum of its elements.

    Arrays & Hashingsliding-windowhash-maptwo-pointersarrays
  • Dynamic ProgrammingMediumAuto-graded
    Count Paths of Fixed Length in a DAG

    Tests dynamic programming on graphs, topological ordering, and systematic state-space enumeration with path-length constraints.

    Dynamic Programminggraphstopological-sortdag2d-dp
  • Trees & GraphsHardAuto-graded
    Diff Two Versions of a Configuration Tree

    Tests recursive-free N-ary tree traversal and set-based diffing to count nodes added, removed, or modified between two tree snapshots.

    Trees & Graphstreeshashingtraversal
  • Data Structure DesignMediumAuto-graded
    Maintain Dynamic Multiset with Rank Queries

    Tests the ability to build a structure that handles insertions and k-th largest queries efficiently using a Fenwick tree over the value domain.

    Data Structure Designfenwick-treebinary-indexed-treerank-queriesmultiset
  • Data Structure DesignMediumAuto-graded
    Simulate a Least Recently Used Cache with Fixed Capacity

    Tests understanding of LRU eviction policy through hash map and doubly-linked list composition to achieve O(1) operations.

    Data Structure Designhash-maplinked-listcachelru
  • Math & Bit ManipulationMediumAuto-graded
    Tank Filling: Can You Hit an Exact Volume?

    Tests whether a candidate can apply GCD-based number theory and state-space reasoning to determine if a target volume is reachable with two containers.

    Math & Bit Manipulationmathbfsnumber-theory
  • Dynamic ProgrammingMediumAuto-graded
    Best Path Sum in Triangle with Required Cell Constraint

    Computes the maximum path sum descending through a triangular grid, both unconstrained and when forced through a specific cell.

    Dynamic Programmingdynamic-programmingpathsoptimization
  • 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
  • StringsMediumAuto-graded
    Find All Pattern Positions in Text

    Tests implementation of efficient string matching and understanding of linear-time pattern search algorithms.

    Stringsstring-matchingkmppattern-search
  • Trees & GraphsMediumAuto-graded
    Grid Obstacle Distances and Palindrome Ancestor Paths

    Tests two skills at once: directional obstacle scanning on a 2D grid, and bitmask-based palindrome counting over rooted-tree ancestor segments.

    Trees & Graphsgridbit-manipulationdfs
  • 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
  • Arrays & HashingEasyAuto-graded
    Paginated Sensor-Alert Filter with Validation

    Tests ability to validate, filter, sort, and paginate structured records while handling malformed entries and boundary conditions correctly.

    Arrays & Hashingarraysfilteringpagination
  • Arrays & HashingMediumAuto-graded
    Bayesian Guessing Game with Unknown Coin Bias

    Compute expected optimal winnings when sequentially guessing coin flips with a uniform-prior unknown bias.

    Arrays & Hashingprobabilitybayesianexpected-valuedynamic-programming
  • 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
  • Dynamic ProgrammingMediumAuto-graded
    Fewest Items to Hit an Exact Weight Target

    Tests whether a candidate can apply 0/1 knapsack DP to find the minimum number of items from a list whose weights sum to exactly a given target.

    Dynamic Programmingdynamic-programmingknapsackarrays
  • Data Structure DesignMediumModel answer
    Concurrent Queue with Bounded Capacity and Graceful Shutdown

    Implement a thread-safe FIFO queue with fixed capacity, blocking operations, timeout support, and coordinated shutdown behavior.

    Data Structure Designconcurrencythreadingsynchronizationmonitor-pattern
  • Arrays & HashingMediumModel answer
    Walk Through Your Subarray Solution and Its Trade-offs

    Given a solution to a subarray-sum problem, explain your approach, prove it correct, analyze complexity, and compare it to at least two alternatives.

    Arrays & Hashingprefix-sumhash-mapcomplexity-analysiscommunication
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Reward Within a Spending Limit

    Tests whether a candidate can apply 0/1 knapsack dynamic programming to maximize total reward without exceeding a fixed spending cap.

    Dynamic Programmingdynamic-programmingknapsackoptimization