KatInterview

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

Coding Interview Problems

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

6045
Problems
2239
Auto-graded
15
Topics
275
Added today

Showing 1291–1320 of 2792 results

  • Trees & GraphsMediumAuto-graded
    Audit a Workflow Run Against Dependencies and Precedence Rules

    Check a run order against a task dependency graph, mandatory tasks and extra precedence pairs, while rejecting duplicates, unknown tasks and cyclic constraints.

    Trees & Graphsgraphtopological-sortcycle-detectionhash-map
  • Arrays & HashingMediumAuto-graded
    First Long Run of Daily Activity per User

    Group activity logs by user, dedupe dates, find maximal consecutive-day runs of length 7 or more, and report each user's earliest such run.

    Arrays & Hashinghashingdatesgaps-and-islandssorting
  • Stacks & QueuesMediumAuto-graded
    Eager Deletion of Repeated Character Blocks

    Scan a string and delete each block of k equal adjacent characters as soon as it forms, handling cascading merges with a run-length stack.

    Stacks & Queuesstackstringrun-lengthsimulation
  • Heaps, Sorting & SearchMediumAuto-graded
    Resume a Sorted Score Listing from a Last-Seen Key

    Filter records by a minimum score, order them by score then id, and return one page after a (score, id) cursor along with the cursor for the following page.

    Heaps, Sorting & Searchpaginationsortingtuple-comparisonheap
  • Stacks & QueuesMediumAuto-graded
    Evaluate Nested Prefix Expressions with Scoped Bindings

    Parse and evaluate a parenthesized prefix language with sum, prod and set, handling lexical scoping, strict validation and 32-bit overflow rules.

    Stacks & Queuesparsingrecursionscopingstack
  • Data Structure DesignMediumAuto-graded
    Subtree Totals Under Collapse and Graft Operations

    Maintain per-node totals in a rooted tree while nodes are collapsed into leaves or have a subtree grafted onto a leaf, answering total queries after each change.

    Data Structure Designtreehash-mapsimulationparent-pointers
  • Data Structure DesignMediumAuto-graded
    Alive-Node Graph Simulator with Gated Edge Insertion

    Simulate a sequence of node toggles, edge edits, and connectivity queries on an undirected graph where only alive nodes count and edges are only added between alive endpoints.

    Data Structure Designunion-findgraphsimulationconnected-components
  • Arrays & HashingEasyAuto-graded
    Share of Users Who Cancel and Never Come Back

    Group booking records by user, find each canceller's earliest cancellation, and compute the percentage with no later confirmed or returned booking.

    Arrays & Hashinghash-maptimestampsgroupingpercentage
  • Stacks & QueuesMediumAuto-graded
    Finish Times for a Single Worker with a Limited Waiting Line

    Simulate a one-worker FIFO queue with a capped waiting line and report each job's finish time or -1 if it was rejected, using a deque of finish times.

    Stacks & Queuesqueuedequesimulationamortized-analysis
  • Data Structure DesignMediumAuto-graded
    Nearest Working Charger: Command Simulator with Great-Circle Math

    Process a batch of commands on a charging-station registry, with status updates, spherical distance and nearest-online lookups that break ties deterministically.

    Data Structure Designdesignsimulationhaversinesorting
  • Trees & GraphsMediumModel answer
    Collect Every Reachable Page on a Single Host

    Write a function that explores a website from one starting URL, following only links on the same hostname, and returns each distinct page once while coping with link cycles.

    Trees & Graphsgraph-traversalbfsurl-normalizationdeduplication
  • Arrays & HashingMediumAuto-graded
    Runner-Up Label by Frequency Tier in a Flat Record List

    Count labels in every third slot of a flat list, find the second-highest distinct count, and break ties by earliest appearance.

    Arrays & Hashinghash-mapcountingfrequencytie-breaking
  • Data Structure DesignMediumModel answer
    Strong vs Weak Counts in shared_ptr and How weak_ptr Breaks Cycles

    Describe the two reference counts in a shared_ptr control block, how weak_ptr uses them, why lock() is needed, and how a weak back-edge fixes a leaking ownership cycle.

    Data Structure Designcppsmart-pointersshared_ptrweak_ptr
  • Arrays & HashingEasyAuto-graded
    Locate Two Entries Adding Up to a Goal Value

    Find two different positions in an integer list whose values sum to a goal, using a deterministic tie-break rule, which tests complement lookup with a hash map.

    Arrays & Hashinghash-maparraycomplement-lookuptwo-sum
  • Data Structure DesignMediumAuto-graded
    Recency-Evicting Store Simulation Plus Graph Group Tally

    Simulate a fixed-size recency-evicting key-value store from a command log, and separately count connected groups in an undirected graph, returning both results together.

    Data Structure Designlru-cachehash-mapordered-dictunion-find
  • Math & Bit ManipulationMediumAuto-graded
    Four Weighted Dice: Lowest Three Add Up to Three

    Compute the exact reduced probability that the three smallest of four independent weighted dice sum to 3, which reduces to counting weighted outcomes with at least three ones.

    Math & Bit Manipulationprobabilitycombinatoricsfractionscounting
  • Math & Bit ManipulationMediumAuto-graded
    Project a Vertex and Its Normal Through a Render Pipeline

    Apply model, view and projection matrices to a point, do the perspective divide and viewport mapping, and transform a normal with the inverse-transpose of the model's 3x3 block.

    Math & Bit Manipulationlinear-algebramatriceshomogeneous-coordinatessimulation
  • Dynamic ProgrammingHardAuto-graded
    Full-String Matching with Dot and Star Wildcards

    Decide whether a whole text matches a pattern with '.' and '*' wildcards, using prefix-based dynamic programming over text and pattern positions.

    Dynamic Programmingdynamic-programmingstringspattern-matchingrecursion
  • Greedy & IntervalsMediumModel answer
    Real-Time Courier-to-Delivery Matching Engine Design

    Design a scalable real-time engine that matches couriers to incoming delivery requests, defining the cost model, candidate pruning, matching method, complexity, and failure handling.

    Greedy & Intervalsmatchinggreedyspatial-indexreal-time
  • Greedy & IntervalsMediumAuto-graded
    Minimum Removals for Conflict-Free Time Slots

    Tests the greedy earliest-finish strategy: find the fewest ranges to discard so the rest share no interior points, with touching endpoints allowed.

    Greedy & Intervalsgreedyintervalssortinginterval-scheduling
  • StringsEasyAuto-graded
    Decode an Ancient Numeral String into a Number

    Parse a valid Roman numeral string into its integer value by handling additive symbols and the six subtractive pairs.

    Stringsstringshash-mapparsingsimulation
  • Arrays & HashingMediumAuto-graded
    Merge Mutual Connections Into Earliest-Confirmed Pairs

    Tests normalizing undirected pairs, filtering pending rows, and keeping the earliest date per pair from a list of event dictionaries, with deterministic sorted output.

    Arrays & Hashinghash-mapgroupingnormalizationsorting
  • Linked ListsEasyAuto-graded
    Combine Two Ascending Sequences Into One

    Tests a two-pointer merge of two non-decreasing integer lists into a single sorted list, handling empty inputs and duplicate values correctly.

    Linked Liststwo-pointersmergesorting
  • StringsMediumModel answer
    Three-Part Drill: Anagram Buckets, One-Swap Max, Sentiment Top-K

    A three-part coding set: bucket words by letter makeup, maximize a number with at most one digit swap, and rank hotels by keyword-based review sentiment.

    Stringshash-mapanagramsgreedytokenization
  • Data Structure DesignMediumModel answer
    Tackling Long-Winded Data Structure Design Problems Step by Step

    Describe a repeatable process for data-structure designs that are simple to state but long to code, then apply it to a price-time-priority limit order book.

    Data Structure Designdata-structure-designorder-bookinvariantslazy-deletion
  • Trees & GraphsMediumModel answer
    Resolve Out-of-Order Variable Assignments in a Mini Language

    Parse lines of integer assignments using only + and -, resolve forward and chained references, and report undefined names and cycles in a well-defined way.

    Trees & Graphstopological-sortparsingdependency-graphcycle-detection
  • StringsMediumAuto-graded
    Shrink Repeated Letters into Letter-Count Pairs

    Encode each maximal run of equal letters as the letter plus its decimal count, and fall back to the input when the encoding is not strictly shorter.

    Stringsstringstwo-pointersrun-length-encodingsimulation
  • Data Structure DesignMediumModel answer
    Build a Persistent Storage Layer for a Mini Database Engine

    Design and implement the last stage of a database engine: a catalog of databases, schemas, and tables plus durable row insert, read, update, and delete that survives restarts.

    Data Structure Designstorage-enginepersistencecrash-safetywrite-ahead-log
  • Data Structure DesignMediumAuto-graded
    Subtree Earnings Ledger with Ranked Threshold Queries

    Simulate a command sequence on a referral forest, maintaining subtree revenue totals and answering ranked queries filtered by a strict threshold.

    Data Structure Designhash-maptreesimulationsorting
  • Data Structure DesignMediumModel answer
    Build a Run-Once Typewriter Component for a Hidden Token

    Build a React and TypeScript component that finds a hidden token in the DOM or over HTTP, types it out every 50ms, never replays the animation, cleans up after itself, and has Mocha tests.

    Data Structure Designreacttypescripthooksasync