KatInterview

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

Coding Interview Problems

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

5993
Problems
2220
Auto-graded
15
Topics
270
Added today

Showing 421–450 of 2771 results

  • StringsEasyAuto-graded
    Keypad Digit Prefix Word Lookup

    Encode words as keypad digit strings and answer many digit-prefix queries quickly using sorted ranges or a trie, returning matches in alphabetical order.

    Stringsbinary-searchprefixsortingtrie
  • Linked ListsEasyAuto-graded
    Exchange the Front Element with the k-th From the Back

    Tests index arithmetic and edge-case handling by swapping the first element of a sequence with its k-th element counted from the end, including the case where both are the same element.

    Linked Listslinked-listtwo-pointersswapedge-cases
  • Data Structure DesignMediumAuto-graded
    Card Settlement Batch with Fees, Rebates and Duplicate Guard

    Simulate a ledger: order card transactions by time, compute integer fee and rebate, enforce balance limits, and flag repeated transaction IDs.

    Data Structure Designsimulationsortinghash-setinteger-arithmetic
  • Data Structure DesignMediumModel answer
    Multi-Device Login Burst Detector over a Late-Tolerant Stream

    Design a streaming detector that flags users with 4 or more distinct devices logging in successfully within 10 minutes, tolerating events up to 30 seconds late, with bounded memory.

    Data Structure Designsliding-windowstreamingwatermarkordered-map
  • Heaps, Sorting & SearchMediumAuto-graded
    Deadline-Priority Ordering of Dependent Jobs

    Produce an execution order for jobs with prerequisites by always running the ready job with the earliest deadline, breaking ties by id, using topological sort with a heap.

    Heaps, Sorting & Searchtopological-sortheapgraphpriority-queue
  • Dynamic ProgrammingMediumAuto-graded
    Nearest Word Lookup Using Minimum Edit Operations

    Compute Levenshtein distance with dynamic programming and pick, for each query, the closest dictionary word with a stable first-index tie-break.

    Dynamic Programmingedit-distancedynamic-programmingstringstie-breaking
  • Dynamic ProgrammingMediumAuto-graded
    Counting Knight-Walk Phone Numbers on a Keypad

    Count length-n digit strings formed by knight jumps on a phone keypad, modulo 1e9+7, using DP over a small fixed graph.

    Dynamic Programmingdynamic-programminggraphmodular-arithmeticcounting
  • StringsMediumAuto-graded
    Fewest Front-Relocations to Rearrange a String

    Count the minimum moves to turn one string into another by moving characters to the front, using a multiset check and a right-to-left greedy subsequence match.

    Stringsstringsgreedytwo-pointerssubsequence
  • Stacks & QueuesEasyAuto-graded
    Check Block Nesting in a Flat Marker Sequence

    Scan a list of tokens and decide whether every OPEN-style marker is matched by a later close marker, using a running counter and early rejection.

    Stacks & Queuescounterbalanced-bracketssingle-passstrings
  • Arrays & HashingEasyAuto-graded
    Build a Route Map Request with Markers and Striped Segments

    Convert longitude-first route points into a map request with start and end markers and path groups of ten segments that alternate colors and share boundary points.

    Arrays & Hashingarraysgroupingtransformationdictionaries
  • Data Structure DesignMediumModel answer
    Build a Terminal Block-Stacking Game Engine

    Design a testable, terminal-friendly engine for a falling-block puzzle on a 10x20 grid, covering movement, rotation, gravity, locking, line clearing and game over.

    Data Structure Designgame-logicstate-machinesimulationobject-oriented-design
  • Arrays & HashingMediumAuto-graded
    Bayesian Inference for Coin Flipping

    Evaluate posterior coin probabilities, posterior predictive likelihoods, and expected stopping times following observed heads.

    Arrays & Hashingprobabilitybayes-theoremexpected-valuebayesian-inference
  • Data Structure DesignMediumAuto-graded
    Deadline-First Job Queue with Prerequisite Gating

    Simulate a job queue where jobs unlock after their prerequisites are consumed, always serving the earliest-deadline unlocked job; tests heaps, dependency counting, and tie-breaking.

    Data Structure Designheaptopological-sortgraphsimulation
  • Data Structure DesignMediumAuto-graded
    Two-Tier Fixed-Window Request Throttle Simulator

    Simulate a throttle that enforces a shared limit and a per-key limit over epoch-aligned fixed windows, with lazy reset and a defined precedence between the two rejection reasons.

    Data Structure Designrate-limiterfixed-windowhash-mapsimulation
  • Trees & GraphsMediumModel answer
    Robot Navigation on a Hidden Grid with DFS and Backtracking

    Guide a robot through a map it can only discover step by step, reaching the target with no repeated visits, real backtracking, and a clear result when the target is unreachable.

    Trees & Graphsdfsbacktrackinggraph-traversalgrid
  • Trees & GraphsEasyAuto-graded
    Locate the Universally Followed Silent Guest

    Find the one node in a directed relation that everyone points to and that points to nobody, using a linear elimination pass followed by verification.

    Trees & Graphsgraphcelebrity-problemtwo-passelimination
  • Data Structure DesignEasyAuto-graded
    Simulate a Task Board with Id-Keyed Commands

    Process a batch of add, update, get and delete commands against an in-memory task store keyed by id, returning one result per command.

    Data Structure Designhash-mapsimulationdesigndictionary
  • Stacks & QueuesMediumAuto-graded
    Wait Time Until a Strictly Larger Sensor Value

    Find, for each position in a sequence, the distance to the next strictly larger element, using a monotonic stack to achieve linear time.

    Stacks & Queuesmonotonic-stackarraysnext-greater-element
  • Trees & GraphsMediumAuto-graded
    Teardown Sequencing with Nested Ownership and Extra Prerequisites

    Find the lexicographically smallest valid ordering of nodes under child-before-parent and extra precedence rules, or report impossibility when the rules contradict.

    Trees & Graphstopological-sortheapcycle-detectiongraph
  • Data Structure DesignMediumAuto-graded
    Longest Dictionary Word Ending With a Given Tail

    Answer batches of suffix queries over a word list, returning the longest match with lexicographic tie-breaking, using a reversed-word trie with cached best words.

    Data Structure Designtriestringssuffixpreprocessing
  • StringsMediumAuto-graded
    String Array Framing and Round-Trip Encoding

    Design a robust serialization scheme that packs a list of arbitrary strings into a single string and successfully reconstructs it without ambiguity.

    Stringsstringsarraysdesign-ds
  • Trees & GraphsMediumModel answer
    Sliding Block Minimums and Dependency-Ordered Cooking Plan

    Compute the minimum of every K x K window in a grid, then order recipes so that every derived ingredient is made before the dish that uses it, detecting cycles.

    Trees & Graphstopological-sortmonotonic-dequesliding-windowkahns-algorithm
  • Arrays & HashingMediumAuto-graded
    Longest Strictly Rising Window After One Edit

    Find the longest contiguous strictly increasing window in an integer array after replacing at most one element with any integer, using prefix and suffix run lengths.

    Arrays & Hashingarrayssliding-windowprefix-suffixdynamic-programming
  • Data Structure DesignHardAuto-graded
    Seat Row Simulator: Leftmost Block Booking and Group Release

    Simulate a row of seats where each booking takes the leftmost free block of a given length and a release frees all of a group's seats, efficiently on large inputs.

    Data Structure Designsegment-treelazy-propagationsimulationinterval-bookkeeping
  • StringsMediumModel answer
    Define and Implement a Streaming Unicode Word Counter

    Specify precise tokenization rules for counting words in text, then build a Unicode-aware counter that works on huge streams, with tests and a regex versus scanner comparison.

    Stringstokenizationunicodestreamingstate-machine
  • Math & Bit ManipulationMediumAuto-graded
    List Every Prime Not Exceeding a Limit

    Tests whether you can enumerate all primes up to a limit efficiently using a sieve instead of per-number primality tests, including the n below 2 edge case.

    Math & Bit Manipulationsieveprimesnumber-theoryarrays
  • Data Structure DesignEasyAuto-graded
    Simulate Stream Price Volatility Monitor

    Execute stateful stream commands to maintain the two most recent values and calculate their difference and floating-point average.

    Data Structure Designdesign-dssimulationstate-management
  • Dynamic ProgrammingMediumAuto-graded
    Count Reachable Totals from a Bounded Coin Collection

    Count the distinct positive totals obtainable from a limited supply of coins per denomination, testing bounded subset-sum reachability with DP or bitset techniques.

    Dynamic Programmingdynamic-programmingsubset-sumbounded-knapsackbitset
  • Stacks & QueuesMediumAuto-graded
    Smallest Subsequence Containing Each Letter Once

    Build the lexicographically smallest subsequence that uses every distinct letter of a string exactly once, using a greedy monotonic stack with remaining-count tracking.

    Stacks & Queuesmonotonic-stackgreedystringssubsequence
  • Greedy & IntervalsMediumModel answer
    Trim Overlapping Ranges to Limit Capacity

    Truncate overlapping integer intervals so no point is covered by more than k ranges while minimizing the total removed coverage.

    Greedy & Intervalsintervalssweep-lineheapgreedy