KatInterview

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

Coding Interview Problems

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

6025
Problems
2231
Auto-graded
15
Topics
274
Added today

Showing 1231–1260 of 2130 results

  • 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
  • StringsMediumAuto-graded
    Words Buildable from Two Different Entries in a Set

    Use a hash set to test every split point of each word, reporting words formable as two distinct list entries, sorted.

    Stringshash-setstringssortingenumeration
  • 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 & 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 & 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
  • 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
  • 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
  • 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 & 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
  • 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
  • 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
  • Data Structure DesignHardAuto-graded
    Type-Safe Storage with Lifetime Tracking

    Tests understanding of object lifetime management, type tracking, and exception safety in a discriminated union implementation.

    Data Structure Designobject-lifetimetype-safetyexception-handling
  • Greedy & IntervalsHardAuto-graded
    Maximize Paired Sum with Coverage Constraint

    Tests greedy reasoning and sorting to maximize the sum of "lesser" elements across a constrained pairing of an even-length array.

    Greedy & Intervalsgreedysortingarrays
  • Arrays & HashingMediumAuto-graded
    Longest Contiguous Subarray with a Target Sum

    Tests prefix-sum reasoning, hash-map lookups, and precise tie-breaking to find the longest subarray summing to exactly k.

    Arrays & Hashingprefix-sumshash-maparrays
  • Data Structure DesignHardAuto-graded
    Versioned Membership Tracker with Point-in-Time Queries

    Tests ability to design a copy-on-write set that records per-element change history and answers historical membership queries in O(log n) via binary search.

    Data Structure Designbinary searchdesignhash map
  • Data Structure DesignMediumAuto-graded
    Sliding Window Request Rate Calculator

    Tests the ability to implement time-bucketed sliding-window aggregation with efficient memory usage and amortized constant-time operations.

    Data Structure Designsliding-windowtime-seriesdata-structuresamortized-analysis
  • Data Structure DesignMediumAuto-graded
    Sliding Window Event Log with Time-Based Expiration

    Design a data structure that tracks timestamped events and supports queries over a moving time window with automatic expiration of old entries.

    Data Structure Designsliding-windowqueuestime-seriesdata-structures
  • StringsMediumAuto-graded
    Minimum Window Containing All Required Characters

    Tests sliding window technique with character frequency tracking to find the smallest substring that satisfies multiplicity constraints.

    Stringssliding-windowtwo-pointershash-map
  • StringsMediumAuto-graded
    Parse and Validate Business Registration CSV Records

    Tests multi-rule sequential validation over CSV rows: field presence, tax ID format normalization, and fuzzy owner name matching via token overlap.

    Stringsstringsparsingvalidation
  • Trees & GraphsMediumAuto-graded
    Balance Root-to-Leaf Path Sums in Binary Tree

    Tests bottom-up tree traversal with greedy balancing, recognizing that shared ancestors minimize total increments across multiple paths.

    Trees & Graphsbinary-treegreedypost-order-traversaltree-dp
  • Data Structure DesignMediumAuto-graded
    Aggregate Sales Data with Running and Grand Totals

    Tests dictionary aggregation, deterministic ordering, and building cumulative totals along two dimensions from grouped records.

    Data Structure Designaggregationdictionariesdata-processing