KatInterview

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

Coding Interview Problems

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

5985
Problems
2218
Auto-graded
15
Topics
271
Added today

Showing 241–270 of 2118 results

  • Arrays & HashingEasyAuto-graded
    Coupon Usage Caps: Check Remaining Redemptions per User

    Count past coupon redemptions per (user, coupon) pair from a log, then answer many read-only queries on whether each user is still under the coupon's cap.

    Arrays & Hashinghash-mapcountingaggregationcomposite-key
  • Math & Bit ManipulationEasyAuto-graded
    Card Launch Unit Economics Report Builder

    Build a fixed unit-economics report for a card launch: portfolio P&L, partnership uplift, bonus payback time, and the zero-profit loss rate.

    Math & Bit Manipulationmathsimulationunit-economicsdictionaries
  • Trees & GraphsMediumAuto-graded
    Unlock Order: Build a Dependency-Respecting Study Plan

    Produce a deterministic topological ordering of nodes from prerequisite pairs, or an empty list if a cycle makes it impossible. Tests graph modeling and Kahn's algorithm.

    Trees & Graphstopological-sortgraphbfscycle-detection
  • Data Structure DesignHardAuto-graded
    Fault-Tolerant Task Dispatcher with Retry Limit and Dependencies

    Simulate a job queue where failed jobs retry up to a limit, then go to a dead-letter list, and failures cascade to jobs that depend on them.

    Data Structure Designsimulationqueuegraphstate-machine
  • Arrays & HashingMediumAuto-graded
    Earliest-Completing Pair That Hits a Target Sum

    Find the pair of indices whose values sum to a target, choosing the pair that finishes earliest in the array, with deterministic duplicate handling, using a one-pass hash map.

    Arrays & Hashinghash-maptwo-sumduplicatesone-pass
  • StringsMediumAuto-graded
    Filter Words Expandable to Target String

    Determine which words from a dictionary can yield a target string by expanding consecutive duplicate characters in place.

    Stringsstringstwo-pointersarrays
  • Arrays & HashingEasyAuto-graded
    Mean Household Earnings with Gaps in the Data

    Compute the mean of a list of numbers while skipping None and NaN entries, returning 0.0 when nothing valid remains and rounding to two decimals.

    Arrays & Hashingarraysdata-cleaningnan-handlingaggregation
  • StringsMediumAuto-graded
    Bracket the Shortest Exclusive Fragment in Every Menu Entry

    Find, for each string, its shortest substring that occurs in no other string (case-insensitive), with leftmost tie-break, and wrap it in brackets while keeping original casing.

    Stringsstringshash-mapsubstringsbitmask
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Bag Selection Probability via Bayes' Theorem

    Given selection priors and ball counts for several containers, calculate the posterior probability of drawing from a specific container after observing a target outcome.

    Math & Bit Manipulationmathprobabilitybayes-theoremarrays
  • Trees & GraphsMediumAuto-graded
    Gather Unique Items Across a Linked Collection Graph

    Run a breadth-first traversal over a directed graph of folders, emitting each item once in first-seen order, while validating every reference and handling cycles.

    Trees & Graphsbfsgraphhash-setdeduplication
  • Arrays & HashingMediumAuto-graded
    Bucket Words That Share the Same Letters

    Partition a list of lowercase words into buckets of mutual rearrangements, using a canonical key and a hash map while keeping a deterministic output order.

    Arrays & Hashinghash-mapstringssortinggrouping
  • Trees & GraphsMediumAuto-graded
    Level-by-Level Site Walk With Failing Pages and a Fetch Cap

    Compute a deterministic level-ordered listing of every page reachable from a start page, where failed pages yield no links and concurrency limits must not change the result.

    Trees & Graphsbfsgraphlevel-ordersets
  • Data Structure DesignEasyAuto-graded
    Simulate a Task Management Engine with CRUD Operations

    Simulate an in-memory task tracker handling creation, retrieval, updates, filtering, and deletion of tasks with valid state validation.

    Data Structure Designdesign-dsarraysdata-structuressimulation
  • Arrays & HashingMediumAuto-graded
    Event Log Selector with Window, Dedupe and Cap

    Filter a list of event records by type, time window and id, then order them stably by timestamp and truncate, testing careful handling of optional arguments and ties.

    Arrays & Hashinghashingstable-sortfilteringdedupe
  • Trees & GraphsMediumAuto-graded
    Fewest Hops from a Start Node While Avoiding Closed Nodes

    Run a breadth-first search on a directed or undirected graph, skipping closed nodes, to get each node's minimum edge count from the start, or -1 if it cannot be reached.

    Trees & Graphsbfsgraphshortest-pathreachability
  • Trees & GraphsMediumAuto-graded
    Identify Cycles in Linear Chains and Directed Networks

    Detect structural loops in both a next-pointer chain using constant space and a directed graph reachable from a given entry point.

    Trees & Graphstrees-graphslinked-listsdfstwo-pointers
  • Arrays & HashingMediumAuto-graded
    Circular Lamps with Traveling Togglers

    Find the final bits on a ring after several togglers walk clockwise for k steps, using lap decomposition, parity, and a cyclic difference array.

    Arrays & Hashingdifference-arraymodular-arithmeticparitysimulation-optimization
  • Math & Bit ManipulationEasyAuto-graded
    Head Counts in n Fair Coin Tosses: Sequences and Tail Odds

    Compute the number of sequences, the chance of exactly 3 heads, and the chance of at most 3 heads for n fair coin tosses, using binomial counting and handling small n.

    Math & Bit Manipulationcombinatoricsbinomialprobabilitymath
  • Arrays & HashingMediumAuto-graded
    Triple Challenge: Price Drops, Bounded Windows, Twin Rows

    Combine a threshold binary search with greedy arithmetic sums, a linear scan counting subarrays with exact min and max, and hashing of binary rows to count identical pairs.

    Arrays & Hashingbinary-searchgreedysliding-windowhashing
  • Heaps, Sorting & SearchMediumAuto-graded
    Read a Value Off a Connected Line-Segment Graph

    Evaluate a piecewise linear curve at a query coordinate by locating the right segment with binary search and interpolating, returning None outside the curve's domain.

    Heaps, Sorting & Searchbinary-searchinterpolationarraysedge-cases
  • Data Structure DesignMediumAuto-graded
    Conditional Form Visibility with Numeric Checks and Nested Groups

    Decide which questions of a form are visible by parsing typed answers and evaluating validated, nestable all/any conditions with numeric comparisons.

    Data Structure Designparsingvalidationrecursiondecimal
  • Math & Bit ManipulationMediumAuto-graded
    Collapse a Sequence to Ones Using Neighbor GCD Replacements

    Find the minimum number of neighbor-GCD replacements to turn an entire array into ones, using shortest coprime-window search and a lower-bound argument.

    Math & Bit Manipulationgcdsubarraynumber-theorycase-analysis
  • StringsMediumAuto-graded
    Earliest Longest Mirror Segment in a String

    Find the longest contiguous segment of a string that reads identically in both directions, preferring the leftmost one on ties and returning an empty string for empty input.

    Stringsstringspalindromeexpand-around-centertwo-pointers
  • Trees & GraphsMediumAuto-graded
    Minesweeper Tap: Flood-Reveal Safe Cells and Show Mine Counts

    Simulate one Minesweeper tap on a grid, flood-revealing connected zero-count cells with an iterative traversal and labelling border cells with their 8-neighbour mine counts.

    Trees & Graphsbfsflood-fillgridmatrix
  • Stacks & QueuesMediumAuto-graded
    Expand a Compressed Bracket Pattern String

    Tests stack-based parsing of nested repeat-count patterns, including multi-digit counts, nesting, and trailing letters, to rebuild the fully expanded string.

    Stacks & Queuesstackstringparsingnested-structures
  • Heaps, Sorting & SearchMediumAuto-graded
    Rotated Array Lookup Plus Most Common Values

    Find a value's index in a rotated sorted array with binary search, then list the k most frequent values with ties broken by smaller value.

    Heaps, Sorting & Searchbinary-searchrotated-arrayhash-mapfrequency-count
  • Dynamic ProgrammingMediumAuto-graded
    Shortest Nested Run-Length Encoding of a String

    Find the shortest nested repeat encoding of a string with interval DP over splits and repeats, using a fixed tie-break order so the output is unique.

    Dynamic Programmingdynamic-programmingstringsrecursionmemoization
  • Data Structure DesignMediumAuto-graded
    Phrase Completion Engine with Windowed Context Counts

    Simulate a command sequence on a context-based next-word model, using hash maps of counts and a lexicographic tie-break.

    Data Structure Designhash-mapn-gramsimulationstring-processing
  • Arrays & HashingMediumAuto-graded
    Contiguous Smallest-Value Blocks in a Shuffled Sequence

    Given a permutation of 1..N, decide for each k whether the values 1..k occupy a contiguous block of positions, using a running min/max position sweep.

    Arrays & Hashingpermutationarrayssweepmin-max
  • Math & Bit ManipulationMediumAuto-graded
    Binary Message Framing Processor

    Simulate encoding and decoding of a length-prefixed binary wire protocol with error validation.

    Math & Bit Manipulationbinaryparsingencodingbit-manipulation