KatInterview

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

Coding Interview Problems

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

5986
Problems
2219
Auto-graded
15
Topics
271
Added today

Showing 301–330 of 2770 results

  • Arrays & HashingMediumAuto-graded
    Sliding Token on a Grid with Timed Heading Changes

    Compute a token's final cell on a grid with blocked cells when its heading changes at given timestamps up to 10^9, which requires processing time segments instead of simulating each tick.

    Arrays & Hashingsimulationgridintervalslarge-input
  • Math & Bit ManipulationMediumAuto-graded
    Group Size Threshold and Closest-Pair Gap on a Circle

    Compute a birthday-collision threshold exactly and by approximation, plus expected minimum gap and tail probability for random points on a circle, with a Poisson comparison.

    Math & Bit Manipulationprobabilitymathbirthday-paradoxpoisson-approximation
  • Data Structure DesignHardModel answer
    Append-Only Log Storage Engine with Torn-Write Recovery

    Build an embedded byte-oriented key-value store on a checksummed append-only log, with an in-memory index, delete markers, thread safety and recovery that truncates a damaged tail.

    Data Structure Designstorage-engineappend-only-logcrash-recoverycrc32
  • Arrays & HashingMediumAuto-graded
    Sliding Window Maxima on a Grid With Source Positions

    Slide a square window over an integer grid with a given step, and report each window's maximum with its grid coordinates, resolving ties by the smallest row, then the smallest column.

    Arrays & Hashingmatrixsliding-windowsimulationtie-breaking
  • Math & Bit ManipulationMediumAuto-graded
    Exponentiation by Squaring with Negative Exponents

    Compute a floating-point base raised to a signed 32-bit integer exponent in logarithmic time, including negative exponents, using repeated squaring.

    Math & Bit Manipulationbinary-exponentiationmathbit-manipulationfloating-point
  • Greedy & IntervalsEasyAuto-graded
    Conflict-Free Schedule Check for a Single Attendee

    Tests sorting intervals and scanning adjacent pairs to detect overlaps under half-open interval rules, where touching endpoints are allowed.

    Greedy & Intervalsintervalssortinggreedyarrays
  • Arrays & HashingEasyAuto-graded
    Coupon Usage Caps: Check Remaining Redemptions per User

    Count past coupon redemptions per (user, coupon) pair from a log, then answer many read-only queries on whether each user is still under the coupon's cap.

    Arrays & Hashinghash-mapcountingaggregationcomposite-key
  • Trees & GraphsMediumModel answer
    Friend Product Suggestions and Click-Path Reachability

    Two short coding tasks: suggest products that a user's friends bought but the user hasn't, and decide whether one URL can reach another through recorded navigation steps.

    Trees & Graphshash-setset-differencegraphbfs
  • Math & Bit ManipulationEasyAuto-graded
    Card Launch Unit Economics Report Builder

    Build a fixed unit-economics report for a card launch: portfolio P&L, partnership uplift, bonus payback time, and the zero-profit loss rate.

    Math & Bit Manipulationmathsimulationunit-economicsdictionaries
  • StringsMediumModel answer
    Verify Validity of Piece Movement on a 1D Board

    Determine whether an initial 1D board configuration can reach a target configuration based on specific movement and jump rules.

    Stringsstringstwo-pointersinvariants
  • Stacks & QueuesMediumModel answer
    Build a Calculator with Variables, Unary Signs and Parentheses

    Write a linear-time evaluator for integer expressions with variables, precedence, unary signs, parentheses, truncating division and 64-bit error handling.

    Stacks & Queuesparsingrecursive-descentexpression-evaluationtokenization
  • Trees & GraphsMediumAuto-graded
    Unlock Order: Build a Dependency-Respecting Study Plan

    Produce a deterministic topological ordering of nodes from prerequisite pairs, or an empty list if a cycle makes it impossible. Tests graph modeling and Kahn's algorithm.

    Trees & Graphstopological-sortgraphbfscycle-detection
  • Data Structure DesignHardAuto-graded
    Fault-Tolerant Task Dispatcher with Retry Limit and Dependencies

    Simulate a job queue where failed jobs retry up to a limit, then go to a dead-letter list, and failures cascade to jobs that depend on them.

    Data Structure Designsimulationqueuegraphstate-machine
  • Arrays & HashingMediumAuto-graded
    Earliest-Completing Pair That Hits a Target Sum

    Find the pair of indices whose values sum to a target, choosing the pair that finishes earliest in the array, with deterministic duplicate handling, using a one-pass hash map.

    Arrays & Hashinghash-maptwo-sumduplicatesone-pass
  • StringsMediumModel answer
    JavaScript Strict vs Loose Equality: Coercion Rules and Pitfalls

    Explain how JavaScript's two equality operators work, how implicit type coercion drives loose equality, where results diverge, and which operator to prefer.

    Stringsjavascripttype-coercionequalitylanguage-fundamentals
  • StringsMediumAuto-graded
    Filter Words Expandable to Target String

    Determine which words from a dictionary can yield a target string by expanding consecutive duplicate characters in place.

    Stringsstringstwo-pointersarrays
  • Arrays & HashingEasyAuto-graded
    Mean Household Earnings with Gaps in the Data

    Compute the mean of a list of numbers while skipping None and NaN entries, returning 0.0 when nothing valid remains and rounding to two decimals.

    Arrays & Hashingarraysdata-cleaningnan-handlingaggregation
  • Trees & GraphsMediumModel answer
    Resolve Variables from Linked Assignment Rules with Cycle Checks

    Evaluate a target variable from a list of assignment strings, growing from simple aliasing to signed sums of variables and integers, then detect circular dependencies safely.

    Trees & Graphsparsingmemoizationdfscycle-detection
  • Data Structure DesignMediumModel answer
    Design a Concurrent Fixed-Size Thread Pool with Task Futures

    Design and implement a fixed-size thread pool with safe task queueing, future result retrieval, exception handling, and graceful or forced shutdown mechanism using basic locks and condition variables.

    Data Structure Designconcurrencythread-pooldesignmultithreading
  • StringsMediumAuto-graded
    Bracket the Shortest Exclusive Fragment in Every Menu Entry

    Find, for each string, its shortest substring that occurs in no other string (case-insensitive), with leftmost tie-break, and wrap it in brackets while keeping original casing.

    Stringsstringshash-mapsubstringsbitmask
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Bag Selection Probability via Bayes' Theorem

    Given selection priors and ball counts for several containers, calculate the posterior probability of drawing from a specific container after observing a target outcome.

    Math & Bit Manipulationmathprobabilitybayes-theoremarrays
  • Trees & GraphsMediumAuto-graded
    Gather Unique Items Across a Linked Collection Graph

    Run a breadth-first traversal over a directed graph of folders, emitting each item once in first-seen order, while validating every reference and handling cycles.

    Trees & Graphsbfsgraphhash-setdeduplication
  • Arrays & HashingMediumAuto-graded
    Bucket Words That Share the Same Letters

    Partition a list of lowercase words into buckets of mutual rearrangements, using a canonical key and a hash map while keeping a deterministic output order.

    Arrays & Hashinghash-mapstringssortinggrouping
  • Trees & GraphsMediumAuto-graded
    Level-by-Level Site Walk With Failing Pages and a Fetch Cap

    Compute a deterministic level-ordered listing of every page reachable from a start page, where failed pages yield no links and concurrency limits must not change the result.

    Trees & Graphsbfsgraphlevel-ordersets
  • Data Structure DesignMediumModel answer
    Build a Quiet-Period Call Delayer in JavaScript

    Write a higher-order function that postpones a callback until calls have stopped for a given time, preserving this and arguments, and discuss cancel, flush and leading-edge variants.

    Data Structure Designjavascriptclosurestimersdebounce
  • Data Structure DesignEasyAuto-graded
    Simulate a Task Management Engine with CRUD Operations

    Simulate an in-memory task tracker handling creation, retrieval, updates, filtering, and deletion of tasks with valid state validation.

    Data Structure Designdesign-dsarraysdata-structuressimulation
  • Math & Bit ManipulationEasyModel answer
    Three Cat Owners and a Truth-or-Lie Rule: Find Bob's Count

    Three friends speak under a rule that ties honesty to who owns more cats. Use the statements, parity, divisibility and a sum bound to find Bob's cat count and the triple of counts.

    Math & Bit Manipulationlogic-puzzlecase-analysisdivisibilityparity
  • Data Structure DesignMediumModel answer
    Build a Single-Use Password Reset Token Manager

    Design an in-memory service that issues reset tokens, enforces expiry and a failed-attempt cap, rejects reused passwords, and makes each token usable only once.

    Data Structure Designstate-machinehash-mapauthenticationttl-expiry
  • Arrays & HashingMediumAuto-graded
    Event Log Selector with Window, Dedupe and Cap

    Filter a list of event records by type, time window and id, then order them stably by timestamp and truncate, testing careful handling of optional arguments and ties.

    Arrays & Hashinghashingstable-sortfilteringdedupe
  • Trees & GraphsMediumAuto-graded
    Fewest Hops from a Start Node While Avoiding Closed Nodes

    Run a breadth-first search on a directed or undirected graph, skipping closed nodes, to get each node's minimum edge count from the start, or -1 if it cannot be reached.

    Trees & Graphsbfsgraphshortest-pathreachability