KatInterview

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

Coding Interview Problems

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

5991
Problems
2219
Auto-graded
15
Topics
270
Added today

Showing 391–420 of 2770 results

  • Greedy & IntervalsEasyAuto-graded
    Indices of Ranges Fully Inside a Query Range

    Scan a list of closed integer ranges and return the indices of those lying entirely within a given query range, testing inclusive boundary handling.

    Greedy & Intervalsintervalsarrayscanboundary-conditions
  • Data Structure DesignEasyAuto-graded
    Replay Operations on a Fixed-Capacity FIFO Buffer

    Simulate a bounded first-in-first-out buffer over a list of put and take commands, rejecting any command that would have to wait.

    Data Structure Designqueuesimulationdesignfifo
  • Trees & GraphsEasyModel answer
    Binary Tree Lateral Perspective and Zero-Sum Triplet Extraction

    Solve two fundamental interview tasks: identifying the rightmost nodes of a binary tree by level and finding non-duplicate zero-sum triplets in an un-ordered array.

    Trees & Graphsbinary-treebfstwo-pointerssorting
  • Trees & GraphsMediumAuto-graded
    Hub Node Pair Counting on a Weighted Tree with Divisible Distances

    Count, for each node of a weighted tree, the unordered pairs of other nodes at distances divisible by k and lying in different branches around that node.

    Trees & Graphstreedfscountingcombinatorics
  • Data Structure DesignEasyAuto-graded
    Field-Level Visibility Filter for Employee Records

    Build a function that returns only the employee record fields a viewer may see, based on admin status, identity, department, reporting line, and view type.

    Data Structure Designaccess-controldictionariessimulationrule-evaluation
  • Data Structure DesignMediumModel answer
    Build a Type-Ahead Catalog Lookup with Cancellation and Caching

    Build an accessible type-ahead lookup that delays requests, discards outdated responses, remembers past queries, supports keyboard control, and copes with errors.

    Data Structure Designfrontendreactdebounceabortcontroller
  • Data Structure DesignEasyModel answer
    Dismiss-Then-Navigate: A Browser Notice Helper in Plain JS

    Write a vanilla JavaScript function that shows a message to the user and moves the page to a given address once the message is closed, skipping the move when the address is not a non-empty string.

    Data Structure Designjavascriptdombrowser-apisevent-handling
  • Data Structure DesignMediumModel answer
    Build a Layered In-Memory Work Tracker with Quotas and Deadlines

    Design an in-memory work tracker in four growing stages: CRUD, name and priority queries, per-user limits with timed assignments, then completion and lateness reports.

    Data Structure Designdesignin-memoryhash-mapsorting
  • Data Structure DesignMediumAuto-graded
    Sliding Log Window: Distinct Tags and Dominant Tag Since a Cutoff

    Replay operations on a bounded, timestamp-ordered log of the newest entries, answering cutoff queries with the distinct key count and the most frequent key (smallest on ties).

    Data Structure Designdesignhash-mapbinary-searchsliding-window
  • Linked ListsMediumAuto-graded
    Locate the Junction of Two Chains in a Successor Table

    Find the first node of one chain that also lies on a second chain, where both chains are encoded in a single successor array, or report -1 if they never converge.

    Linked Listslinked-listhash-settwo-pointersintersection
  • Heaps, Sorting & SearchEasyAuto-graded
    Permutation Search Sort: Order a List by Brute Force

    Implement a factorial-time sort that tries arrangements until one is non-decreasing, handling duplicates and empty input, and reason about its cost.

    Heaps, Sorting & Searchsortingpermutationsbrute-forcecomplexity-analysis
  • Greedy & IntervalsHardAuto-graded
    Find Continuous Peak Resource Load

    Find the maximum aggregate load over a set of half-open intervals and identify the earliest contiguous time window sustaining it.

    Greedy & Intervalssweep-lineintervalsarrayssorting
  • Data Structure DesignMediumModel answer
    Design a Thread-Safe Log Rotating Sink

    Implement a thread-safe, size-bounded rotating file sink class adhering to Liskov substitution and Python context manager protocols.

    Data Structure Designobject-oriented-designconcurrencyfile-iopython
  • Heaps, Sorting & SearchEasyAuto-graded
    Impute Missing Grades and Rank Top Candidates

    Process raw assessment records by replacing missing marks with course-level medians and return the top 5 performers.

    Heaps, Sorting & Searchsortingdata-cleaninghash-tableaggregations
  • Arrays & HashingMediumAuto-graded
    Longest Run Using Only Two Flavors

    Find the longest contiguous stretch of an integer array containing at most two distinct values, testing sliding window and frequency tracking.

    Arrays & Hashingsliding-windowtwo-pointershash-map
  • Data Structure DesignHardModel answer
    Build a Scalable Memory-Constrained API Ingestion Pipeline

    Ingest, normalize, filter, and stream-sort paginated API data under memory constraints with exponential backoff and rate limiting.

    Data Structure Designpaginationrate-limitingexternal-sortdata-engineering
  • Math & Bit ManipulationEasyModel answer
    Counting Iterations of a C Loop With an Assignment Condition

    Work out how many times a C for-loop body runs when its condition is an assignment expression rather than a comparison, and explain the final variable values.

    Math & Bit Manipulationc-languagecontrol-flowoperatorsassignment-expression
  • Data Structure DesignMediumModel answer
    Interleaved Dual-Thread Sequencer

    Coordinate two concurrent threads to output consecutive integers from 1 to n in strictly alternating parity order.

    Data Structure Designconcurrencythreadingsynchronizationmutex
  • Math & Bit ManipulationHardAuto-graded
    Stop or Pass: Optimal Play in a Two-Player Dice Duel

    Find the optimal accept/reject rule and the game value for a symmetric alternating-roll zero-sum game, using a stationary fixed-point equation.

    Math & Bit Manipulationexpected-valuegame-theoryoptimal-stoppingfixed-point
  • Stacks & QueuesEasyAuto-graded
    Balanced Delimiters Checker

    Decide whether a string made only of round, square and curly brackets is correctly paired and nested, which tests stack-based matching and edge-case handling.

    Stacks & Queuesstackstringsparsing
  • Trees & GraphsMediumAuto-graded
    Cluster Counting on a Grid with King-Move Adjacency

    Count groups of touching 1-cells in a binary grid where all eight surrounding cells count as neighbors, testing grid traversal and connected-component counting.

    Trees & Graphsgridbfsconnected-componentsmatrix
  • Data Structure DesignMediumAuto-graded
    Batch Processor for a Directed Follow Graph

    Simulate a sequence of follow, unfollow, and query operations on a directed user graph, keeping outgoing and incoming edge views consistent and returning sorted results.

    Data Structure Designhash-mapsetgraphdesign
  • Data Structure DesignMediumModel answer
    Spot the Slicing and Double-Free Bugs in a C++ Buffer Hierarchy

    Review a C++ class hierarchy that owns a raw heap buffer, explain why passing it by value breaks it, and rewrite it with modern ownership and correct polymorphic dispatch.

    Data Structure Designcppraiirule-of-fiveobject-slicing
  • Arrays & HashingEasyAuto-graded
    Maximum Length of Identical Merged Arrays

    Find the maximum size of two matching arrays derived by repeatedly combining adjacent elements from two positive integer sequences, or return -1 if impossible.

    Arrays & Hashingarrayshash-tabletwo-pointersprefix-sum
  • Data Structure DesignHardModel answer
    Payment Command Parser and Lifecycle State Machine Design

    Design a parser for fixed-arity payment commands and an object-oriented lifecycle state machine, and identify which business rules need clarification before implementation.

    Data Structure Designstate-machineparsingobject-oriented-designvalidation
  • Data Structure DesignHardModel answer
    Variable-Argument Functions Across Languages, with a Safe Logger

    Compare how two languages implement functions with a variable number of arguments, then design a type-checked key-value logger that avoids injection and needless allocation.

    Data Structure Designvariadic-functionstype-safetycalling-conventionslogging
  • Greedy & IntervalsEasyAuto-graded
    Till Payout: Greedy Bills and Coins, Listed A to Z

    Parse decimal money strings exactly into cents, detect underpayment or exact payment, then greedily break the change into named bills and coins and output them sorted alphabetically.

    Greedy & Intervalsgreedystringsparsingsorting
  • Trees & GraphsMediumAuto-graded
    Right-Triangle Distance Vertices in a Tree

    Compute distances in a tree from three marked vertices and count the other vertices whose three distances form a right-triangle (Pythagorean) triple.

    Trees & Graphsbfstreegraph-traversalmath
  • Data Structure DesignMediumAuto-graded
    Shelf Command Simulator with Versioned Edits and Durable Bookmarks

    Simulate a shelf of books with positional ordering, version-checked edits and ID-based bookmarks that survive reordering and are cleaned up on deletion.

    Data Structure Designdesignhash-mapsimulationoptimistic-concurrency
  • 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