KatInterview

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

Coding Interview Problems

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

5980
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 1951–1980 of 2115 results

  • Trees & GraphsMediumAuto-graded
    Aggregate User Permissions Through Account Ancestry

    Tests hierarchical graph traversal and efficient permission accumulation using ancestor path lookup and set operations.

    Trees & Graphsgraphstreesbfscaching
  • Trees & GraphsMediumAuto-graded
    Calculate Cumulative Task Weights in a Dependency Graph

    Tests graph traversal and dynamic programming on DAGs to compute propagated weight contributions through dependency chains.

    Trees & Graphsgraphsdagtopological-sortdynamic-programming
  • Trees & GraphsMediumAuto-graded
    Rank Build Targets by Dependency Order

    Tests whether a candidate can produce a valid topological ordering of a build-dependency DAG and apply a precise tie-break rule when multiple orderings exist.

    Trees & Graphsgraphstopological sortBFSKahn's algorithm
  • Trees & GraphsHardAuto-graded
    Fastest Delivery Route with Fuel Station Stops

    Tests the ability to extend Dijkstra's algorithm with a constrained resource (fuel), requiring candidates to track both position and remaining fuel as state.

    Trees & Graphsgraphsdijkstrashortest pathdynamic programming
  • Dynamic ProgrammingHardAuto-graded
    Construct Arithmetic Expression Matching Target

    Tests subset enumeration with bitmask DP, binary expression tree generation, operator application with exact rational arithmetic, and combinatorial search.

    Dynamic Programmingbitmask-dprecursioncombinatorics
  • Trees & GraphsMediumAuto-graded
    Identify Connected Power Grid Regions

    Tests union-find (disjoint set union) to group transmission lines into connected components and answer queries about grid connectivity.

    Trees & Graphsunion-findgraphsconnected-components
  • Trees & GraphsMediumAuto-graded
    Greenhouse Disease Spread Timer

    Tests multi-source BFS to find the time until a grid-based propagation process completes or determine impossibility.

    Trees & Graphsbreadth-first-searchgridmulti-source-bfs
  • 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
  • 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
  • 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
  • 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 & 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
  • Arrays & HashingMediumAuto-graded
    Retrieve Minimum and Mode from Array

    Tests efficient computation of two simple aggregate statistics using optimal data structures and complexity analysis.

    Arrays & Hashinghash-mapscountingcomplexity-analysis
  • Math & Bit ManipulationMediumAuto-graded
    Count Pairs Whose XOR Has Exactly K Set Bits

    Tests the ability to combine bit counting (popcount) with efficient pair enumeration to find pairs in an array whose XOR contains exactly K set bits.

    Math & Bit Manipulationbit manipulationnumber theorycombinatorics