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 991–1020 of 2784 results

  • Greedy & IntervalsEasyAuto-graded
    Summarize Integer Ranges into String

    Process an unorganized array of integers by sorting, deduplicating, and formatting contiguous numerical ranges into a compact string.

    Greedy & Intervalsarrayssortingintervalsstrings
  • Trees & GraphsEasyAuto-graded
    Collect Every File Path from a Nested Directory Tree

    Traverse a nested directory dictionary depth-first and build the full slash-joined path for each file, following precise joining and ordering rules.

    Trees & Graphsdfstree-traversalrecursionstrings
  • Arrays & HashingMediumAuto-graded
    Per-Unit Coupon Pricing with Half-Even Cent Rounding

    Total a shopping cart where each coupon discounts one unit of its item, with percent discounts rounded half-to-even in exact integer arithmetic.

    Arrays & Hashinghash-mapsimulationroundinginteger-math
  • Data Structure DesignMediumModel answer
    Designing Dynamic Load Balancers: Round-Robin and Consistent Hashing

    Implement a resilient round-robin request balancer that handles dynamic server membership, followed by a consistent hashing router to maintain key affinity.

    Data Structure Designdesign-dshashingconcurrencybinary-search
  • Trees & GraphsMediumModel answer
    Build a Collapsible JSON Tree Renderer in React

    Design and implement a React component to display nested JSON with collapsible nodes, indentation, and syntax highlighting for primitive types.

    Trees & GraphsReactJSONTreeFrontend
  • Math & Bit ManipulationMediumAuto-graded
    Aggressive Wagering: Chance of Hitting the Goal Before Going Broke

    Model a state-dependent betting strategy as a Markov chain and solve absorption probabilities, including cycles, via a linear system.

    Math & Bit Manipulationprobabilitymarkov-chainlinear-algebragaussian-elimination
  • Arrays & HashingEasyAuto-graded
    Compute Post-Match Standardized Mean Differences

    Evaluate post-matching covariate balance by computing the absolute standardized mean difference across features.

    Arrays & Hashingstatisticsmath-bitsarrays
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Product Mix Profitability Metrics

    Computes baseline and mix-shifted unit profit averages, per-unit margin delta, and overall impact on profit given total volume.

    Math & Bit Manipulationmatharrays
  • Data Structure DesignMediumAuto-graded
    Banned-Word Review Screener with Per-User Strike Counts

    Simulate a stateful screening service driven by an operation log: whole-token, case-insensitive banned-word checks, replaceable word lists, and per-user flagged-review tallies.

    Data Structure Designhash-sethash-mapsimulationstrings
  • Arrays & HashingEasyAuto-graded
    Rollout Impact: Diff-in-Diff Estimate with Baseline Drift Check

    Aggregate per-group, per-window means from daily records, compute a difference-in-differences estimate, and flag baseline drift between two pre-period sub-windows.

    Arrays & Hashinghashingaggregationstatisticsdate-windows
  • Data Structure DesignMediumModel answer
    Refactoring and Hardening a Driver Dispatch Service

    Identify anti-patterns in legacy dispatch assignment code, implement fixes, introduce domain types, and design for thread-safety.

    Data Structure Designrefactoringthread-safetyobject-oriented-designclean-code
  • Heaps, Sorting & SearchMediumAuto-graded
    Determine the K-th Highest Score in an Unsorted Array

    Find the k-th largest value in an unsorted array of integers without fully sorting the input.

    Heaps, Sorting & Searcharrayssortingdivide-and-conquerquickselect
  • Arrays & HashingEasyAuto-graded
    Generate Cartesian Product of Search Space Parameters

    Construct all explicit configurations from a dictionary mapping parameter names to lists of candidate values using Cartesian product generation.

    Arrays & Hashingcartesian-productgeneratorarraysdictionary-manipulation
  • Dynamic ProgrammingHardModel answer
    Identify Compound Words in a Dictionary

    Find all strings in a list that can be constructed by concatenating two or more smaller strings from the same list.

    Dynamic Programmingstringsdynamic-programmingtriehash-table
  • StringsEasyAuto-graded
    Count Case-Sensitive Occurrences in a Text

    Count how many times a target character, or substring, appears in a text under case-sensitive, non-overlapping matching.

    Stringsstringscountingsubstringcase-sensitive
  • Arrays & HashingMediumAuto-graded
    Find Most Overlapping Pair of Sets

    Find the pair of set keys with the highest intersection size, using Jaccard similarity and lexicographical order as tie-breakers via an inverted index approach.

    Arrays & Hashinginverted-indexhash-tablearraysstring
  • Trees & GraphsMediumAuto-graded
    Group Binary Tree Nodes into Vertical Columns

    Group nodes of a binary tree represented in array heap layout into vertical columns ordered from left to right.

    Trees & Graphstrees-graphsbreadth-first-searchbinary-treequeues
  • Trees & GraphsMediumAuto-graded
    Count Separate Land Masses in a Grid

    Evaluate grid graph connectivity by finding the number of distinct 4-directionally connected land components.

    Trees & Graphstrees-graphsdfs-bfsgrid
  • Data Structure DesignMediumAuto-graded
    Least Recently Used Storage Simulation

    Simulate a fixed-capacity Least Recently Used (LRU) storage engine that processes lookup and insert operations in O(1) time.

    Data Structure Designdesign-dslinked-listsarrays
  • Greedy & IntervalsMediumAuto-graded
    Collapse Booked Time Slots into Disjoint Blocks

    Combine a list of [start, end] ranges so that any that overlap or touch become one range, using sorting and a single sweep.

    Greedy & Intervalsintervalssortinggreedyarrays
  • Data Structure DesignMediumModel answer
    Build Stateful Round-Robin and Consistent Hash Load Balancers

    Implement thread-safe Round-Robin and Consistent Hashing balancers supporting health checks and dynamic nodes, then analyze their performance.

    Data Structure Designload-balancerconsistent-hashinground-robindata-structure-design
  • Arrays & HashingMediumAuto-graded
    Grid Editor: Flip Rows, Swap Rows, and Turn Clockwise

    Simulate a sequence of string commands (row reversal, row swap, 90-degree clockwise turn) on a rectangular grid whose shape changes after each turn.

    Arrays & Hashingmatrixsimulationstring-parsingrotation
  • Heaps, Sorting & SearchMediumAuto-graded
    Find Frequent Elements with Custom Tie-Breaking

    Count item occurrences and retrieve the top k highest-frequency elements, sorting tied elements by value ascending.

    Heaps, Sorting & Searcharrayssortinghash-table
  • Greedy & IntervalsMediumModel answer
    Pinpoint Bad Nodes with Disjoint Group Probes of Size Two or More

    Find exactly which cluster nodes are bad when the only probe is a group test that fails if any member is bad, parallel probes must be disjoint, and each probe needs at least two nodes.

    Greedy & Intervalsgroup-testingadaptive-algorithmsround-robin-schedulingidentifiability
  • Stacks & QueuesMediumModel answer
    Evaluate Arithmetic Expressions and Decode Nested Run-Length Strings

    Implement two production-ready string parsers: an arithmetic evaluator supporting basic operators and precedence, and a nested string expansion utility.

    Stacks & Queuesstackparsingstringsexpression-evaluation
  • Arrays & HashingMediumAuto-graded
    Product of Two Mostly-Zero Grids

    Compute the product of two mostly-zero integer matrices by precomputing nonzero positions so that no work is spent on zero operands.

    Arrays & Hashingmatrixsparsesimulationhashing
  • Data Structure DesignMediumModel answer
    Build an In-Memory Playlist Engine with a Three-Slot Favorites Set

    Design a thread-safe in-memory audio player with a queue, history, and a favorites list capped at three that rejects overflow deterministically rather than evicting.

    Data Structure Designdesigndequehash-mapconcurrency
  • Math & Bit ManipulationEasyModel answer
    Circle Point Generation, Strict Monotonic Run, and Histogram Interpolation

    Solve three foundational tasks: uniform random sampling within a disk, tracking the longest strictly increasing contiguous array, and computing bucketed percentiles.

    Math & Bit Manipulationsamplingarraysinterpolationmath
  • Data Structure DesignMediumModel answer
    Build a Plain-Text Notes REST API and Black-Box Test Plan

    Design a small CRUD HTTP service that accepts raw text bodies but replies in JSON, then explain how to test an unseen function from its specification alone.

    Data Structure Designrest-apihttp-status-codesunit-testingflask
  • Greedy & IntervalsEasyAuto-graded
    Minimum Days to Complete Sequential Tasks With Daily Time Budgets

    Greedy single-pass simulation: pack tasks in order into daily time budgets without splitting, and return the day count or -1 if impossible.

    Greedy & Intervalsgreedysimulationtwo-pointersarrays