KatInterview

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

Coding Interview Problems

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

5995
Problems
2220
Auto-graded
15
Topics
270
Added today

Showing 451–480 of 2772 results

  • 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
  • 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 DesignMediumModel answer
    Building a Multi-Level Credit Ledger with Timed Transfers and Merges

    Build an in-memory ledger of credit-holding workspaces in four stages: transfers with a top-k ranking, timed transfers with cancellation, workspace merges, and point-in-time balance lookups.

    Data Structure Designclass-designheapbinary-searchsimulation
  • Data Structure DesignMediumModel answer
    Prefix-Caching Transform Runner with Single-Flight and LRU

    Build a thread-safe runner for chains of deterministic byte transforms that reuses cached prefixes, collapses concurrent duplicate work into one execution, and bounds memory with LRU eviction.

    Data Structure Designconcurrencylru-cachehashingsingle-flight
  • Math & Bit ManipulationMediumModel answer
    Build an Endless Fibonacci Stream with Python Generators

    Explain how lazy evaluation works in Python and write a generator that yields Fibonacci numbers indefinitely, with safe ways to consume it and the reasoning behind its state handling.

    Math & Bit Manipulationpythongeneratorslazy-evaluationfibonacci
  • 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
  • Trees & GraphsMediumModel answer
    Find a Money-Making Loop in a Table of Exchange Rates

    Given directed currency exchange quotes, decide whether some round trip returns more than it started with, and output one such round trip as an ordered list of currencies.

    Trees & Graphsgraphbellman-fordnegative-cyclefloating-point
  • 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
  • Arrays & HashingMediumModel answer
    Cyclic Shifts and Cell-Level Keyword Lookup in CSV Text

    Shift an integer array left or right by k using modular arithmetic, then locate every occurrence of one or more keywords in a simple CSV string, reporting row, column and offset in the cell.

    Arrays & Hashingarray-rotationmodular-arithmeticstring-searchcsv-parsing
  • Data Structure DesignMediumModel answer
    Build a Sampler That Picks Items in Proportion to Mutable Weights

    Design a structure holding items with positive integer weights that supports insert, delete and a weight-proportional random pick, each in logarithmic time.

    Data Structure Designfenwick-treeweighted-samplingrandomizationdata-structure-design
  • Data Structure DesignMediumModel answer
    Dealing and Ranking Three-Card Hands With an Extensible Rule Set

    Build a small card game that deals three cards per player from one deck, ranks hands by category, picks the winner, then extend the ranking with a suit-based category.

    Data Structure Designobject-oriented-designsimulationcomparisonextensibility
  • 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
  • Arrays & HashingEasyAuto-graded
    Collapse Round-Trip Routes into Distinct City Pairs

    Normalize directed city pairs into unordered ones, remove duplicates, and return them in sorted order, testing canonicalization with hashing and sorting.

    Arrays & Hashinghashingsortingdeduplicationcanonical-form
  • Data Structure DesignMediumModel answer
    Searchable Dropdown Input with Live Async Suggestions in React

    Implement a React search box whose dropdown fills with suggestions from an abortable async source and works fully by keyboard and mouse, without ever showing outdated results.

    Data Structure Designreacthooksasyncaccessibility
  • Trees & GraphsMediumAuto-graded
    Route Between Two Nodes of an Implicit Recursive Tree

    Find the unique path between two pre-order-indexed nodes in a huge recursively defined tree, using subtree sizes to navigate without building it.

    Trees & Graphstreelcarecursionpre-order
  • Data Structure DesignHardModel answer
    Dynamic Room Occupancy Tracker with Top-K Ranking Query

    Design an in-memory system tracking occupancy and entry times across rooms, returning the busiest rooms in optimal logarithmic time per update.

    Data Structure Designdesign-dsheaps-sortinghash-map
  • Arrays & HashingMediumAuto-graded
    Busiest Network Addresses With Tie-Inclusive Top Ten Cutoff

    Normalize IPv4/IPv6 strings, skip invalid ones, count occurrences, and return the top ten addresses while keeping every address tied at the tenth-place frequency.

    Arrays & Hashinghash-mapcountingsortingstring-parsing
  • Trees & GraphsMediumAuto-graded
    Strongest Signal Route in a Lossy Link Network

    Find the route between two nodes in an undirected graph that maximizes the product of per-link delivery probabilities, using a Dijkstra-style search with a max-priority queue.

    Trees & Graphsgraphdijkstraheapshortest-path
  • Data Structure DesignEasyAuto-graded
    Replay Tennis Game Commands and Report Scores

    Simulate a single tennis game from a command log, tracking points, deuce, advantage and the winner, and return each score query's text.

    Data Structure Designsimulationstate-machinedesignstrings
  • Heaps, Sorting & SearchMediumAuto-graded
    Boosting Your Budget With a Limited Number of Ventures

    Greedy selection with a sorted unlock pointer and a max-heap: repeatedly pick the most profitable venture whose entry threshold fits the current funds, up to a fixed number of picks.

    Heaps, Sorting & Searchheapgreedysortingpriority-queue
  • Data Structure DesignHardAuto-graded
    Versioned Cache and Longest Dependency Chain

    Process a series of timestamped key-value operations and find the longest non-cyclic path in a dependency graph.

    Data Structure Designdesign-dstrees-graphsdynamic-programmingbinary-search
  • StringsMediumModel answer
    Build a Streaming Lisp-Style Expression Reader with Exact Error Positions

    Write a single-pass reader for a small Lisp-like syntax with integers, symbols and nested lists, reporting the first error with a clear message and exact character index.

    Stringsparsingrecursive-descenterror-handlings-expression
  • Data Structure DesignMediumModel answer
    Designing a Validated In-Memory Cache for Repeated Parsing

    Speed up a script that repeatedly parses files by adding a thread-safe, bounded, in-memory cache, and justify its keys, eviction, staleness checks and complexity.

    Data Structure Designcachinghash-maplruconcurrency
  • Data Structure DesignHardAuto-graded
    Simulate Alternating Tic-Tac-Toe Game Engine

    Process a series of game instructions to maintain state, validate turns and positions, and return outcome status for each operation.

    Data Structure Designdesign-dsarraysstate-machine
  • Trees & GraphsMediumAuto-graded
    Balanced BST Level-Order Output from a Sorted Sequence

    Build a height-balanced BST from a sorted list using a fixed middle-element rule, then serialize it level by level with null placeholders.

    Trees & Graphsbinary-search-treedivide-and-conquerrecursionlevel-order-traversal