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
273
Added today

Showing 1201–1230 of 2130 results

  • Math & Bit ManipulationEasyAuto-graded
    Sales Volume Needed to Hold Margin After a Menu Expansion

    Derive a closed-form sales volume that keeps profit margin unchanged after adding a second product with extra fixed costs, and reject unreachable targets.

    Math & Bit Manipulationmathalgebrabreak-evenprofit-margin
  • Arrays & HashingMediumAuto-graded
    Probability Toolkit: Gamble Moments, Dice, Arrivals, Odds, Draws

    Compute expected value and variance, a dice conditional probability, a Poisson tail, betting edge with Kelly sizing, and a without-replacement card probability in one function.

    Arrays & Hashingprobabilityexpected-valueconditional-probabilitypoisson
  • Arrays & HashingEasyAuto-graded
    Rolling window totals over filtered records in input order

    Tests filtering a list of tagged records and computing rolling window totals in O(n) using an incremental sum instead of recomputing each window.

    Arrays & Hashingsliding-windowprefix-sumfilteringarrays
  • Greedy & IntervalsMediumAuto-graded
    Locate the Lowest-Indexed Room That Can Fit a Meeting

    Tests interval overlap checks under half-open semantics and using binary search on sorted, disjoint bookings to find a free room quickly.

    Greedy & Intervalsintervalsbinary-searchsortinghalf-open-ranges
  • Stacks & QueuesEasyAuto-graded
    Nested Delimiter Checker for Config Expressions

    Checks whether a string of mixed parentheses, braces, and square brackets is properly nested, testing stack-based matching and early rejection in linear time.

    Stacks & Queuesstackparsingstringmatching
  • Arrays & HashingMediumAuto-graded
    Detect a Run of Two or More Elements Summing to a Multiple of k

    Tests prefix-sum reasoning with hashing: detecting a contiguous run of length at least two whose sum is divisible by k, including the k = 0 special case.

    Arrays & Hashingprefix sumhash mapremainderssubarray
  • Data Structure DesignMediumAuto-graded
    LRU Cache Simulator with Recency and Grouped Views

    Simulates an LRU cache through a sequence of put, get, and snapshot operations, testing recency bookkeeping, eviction, and ordered grouping of values.

    Data Structure DesignLRU cacheOrderedDicthash mapsimulation
  • Data Structure DesignMediumAuto-graded
    Batch Simulation of an Expiring LRU Key-Value Store

    Replay a batch of timestamped get and set operations against a fixed-capacity store that combines per-key expiry with least-recently-used eviction.

    Data Structure Designhash maplinked listLRU cachesimulation
  • Greedy & IntervalsMediumAuto-graded
    Count Active Ranges at Query Points

    Tests whether a candidate can efficiently count how many inclusive ranges cover each of a set of query values using binary search decomposition.

    Greedy & Intervalsbinary-searchintervalssorting
  • Math & Bit ManipulationEasyAuto-graded
    Factorial Trailing Zeros Without Building the Factorial

    Count the base-10 trailing zeros of n! by tallying factors of 5, never constructing the enormous factorial itself.

    Math & Bit Manipulationmathnumber-theoryfactorialcounting
  • StringsMediumAuto-graded
    Interleave Characters from String Ends

    Rebuild a string by alternately picking characters from opposite ends until all are consumed, testing two-pointer convergence logic.

    Stringstwo-pointersstring-manipulationarray
  • Dynamic ProgrammingMediumAuto-graded
    Fewest Coins to Form Target Sum

    Tests dynamic programming with unbounded resources to compute the minimal coin count for a target value, handling impossible cases.

    Dynamic Programmingdynamic-programmingcoin-changeoptimization
  • Arrays & HashingHardAuto-graded
    Maximize Total Distinct Values Across Two Arrays

    Tests greedy reasoning, frequency counting, and backtracking search to maximize the combined distinct-value count across two arrays given a limited swap budget.

    Arrays & Hashingbacktrackinggreedyfrequency-counting
  • Linked ListsMediumAuto-graded
    Walking Both Ways to Measure a Doubly Linked Chain

    Given neighbor links for a group of disjoint chains, count how many nodes sit in the chain containing a given start node.

    Linked Listslinked-listtraversaltwo-pointerssimulation
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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