KatInterview

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

Coding Interview Problems

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

5988
Problems
2219
Auto-graded
15
Topics
271
Added today

Showing 331–360 of 2119 results

  • 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
  • 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 & 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
  • 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
  • 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
  • Trees & GraphsMediumAuto-graded
    Semester Planner: Build a Valid Course Sequence

    Produce a deterministic topological ordering of courses from prerequisite pairs, or an empty list when a circular requirement makes it impossible.

    Trees & Graphstopological-sortgraphbfscycle-detection
  • Data Structure DesignMediumAuto-graded
    Skill-Based Task Dispatcher Simulation

    Simulate a dispatcher that gives queued tasks to skilled workers by project priority and current load, using per-project queues and tie-break rules.

    Data Structure Designdesignsimulationheaphash-map
  • Arrays & HashingEasyAuto-graded
    Tally Opening Click-Paths Across Shoppers

    Group timestamped events by user, order them in time, and count how many distinct users share each opening action sequence of length up to k.

    Arrays & Hashinghash-mapgroupingsortingprefixes
  • StringsMediumAuto-graded
    Split Text by Longest Dictionary Prefix with Single-Char Fallback

    Scan a string left to right, always consuming the longest dictionary word starting at the current position, or one character if none match; tests tries and prefix matching.

    Stringstriegreedystring-processingprefix-matching
  • Data Structure DesignMediumAuto-graded
    Per-Key Token Bucket Admission Decisions

    Simulate independent token buckets per key over a request log, with exact fractional refill, capped capacity, and out-of-order timestamps, to decide which requests are admitted.

    Data Structure Designrate-limitertoken-buckethash-mapsimulation
  • Stacks & QueuesMediumAuto-graded
    Evaluate a Spaced Arithmetic String Without Parentheses

    Evaluate an integer expression with +, -, *, / using standard precedence and truncating division, in a single pass over a string with arbitrary spacing.

    Stacks & Queuesparsingstringstackoperator-precedence
  • Data Structure DesignMediumAuto-graded
    Expiring Compute Credits: Earliest-Expiry-First Ledger Simulation

    Simulate a credit ledger replaying a command list, spending the soonest-expiring grants first, with all-or-nothing spends and time-based expiry.

    Data Structure Designheapsimulationgreedydesign
  • Data Structure DesignMediumAuto-graded
    Linked Cell Grid with Cycle-Safe Formula Updates

    Simulate a 26x26 grid whose cells hold integers or one-reference offset formulas, answering lookups lazily and rejecting any formula assignment that would close a dependency loop.

    Data Structure Designgraphcycle-detectionsimulationhash-map
  • Trees & GraphsMediumAuto-graded
    Earliest Safe Starting Cell in a Jump Array

    Find the smallest start index in a jump array whose walk never goes below index 0, handling cycles and right exits, ideally in linear time.

    Trees & Graphsfunctional-graphcycle-detectionmemoizationarrays