KatInterview

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

Coding Interview Problems

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

6000
Problems
2221
Auto-graded
15
Topics
273
Added today

Showing 511–540 of 2774 results

  • StringsMediumAuto-graded
    Validate a Plain Signed Decimal Literal

    Check whether a string is a well-formed plain decimal literal (optional sign, digits, optional fraction) by turning a small grammar into a careful single-pass validator.

    Stringsstringsparsingvalidationedge-cases
  • Arrays & HashingMediumAuto-graded
    Monthly Signup Cohorts: Day-30 Return Rate

    Group users by first-activity month and compute the share who return exactly 30 days later, excluding users whose day 30 lies beyond the last observed date.

    Arrays & Hashinghash-mapdatescohort-analysisgrouping
  • StringsEasyAuto-graded
    Reassemble Framed Messages from Chunked Byte Streams

    Join byte chunks from a simulated stream and split them into complete messages, using either a 4-byte length prefix or newline delimiters, while ignoring any incomplete tail.

    Stringsbyte-streamparsingframingbuffering
  • Heaps, Sorting & SearchEasyAuto-graded
    Sort Array and Compute Unique Intersection

    Tests implementing custom merge sort to sort an array and finding the sorted unique intersection of two lists.

    Heaps, Sorting & Searchsortingmerge-sorthash-setarrays
  • StringsMediumAuto-graded
    Evaluate a Nested Let/Add/Mult Expression, or Report Invalid

    Tokenize, validate and evaluate a small Lisp-like language with scoped let bindings, returning None for any malformed or ill-formed input.

    Stringsparsingrecursionscopestring-processing
  • Trees & GraphsMediumAuto-graded
    Can Every Module in a Study Plan Be Finished?

    Decide whether a set of ordering rules between numbered modules contains a circular dependency, by detecting a cycle in a directed graph.

    Trees & Graphsgraphtopological-sortcycle-detectionbfs
  • Trees & GraphsMediumAuto-graded
    Minimum Degrees of Separation in a Social Network

    Determine the shortest path distance between two nodes in an unweighted, undirected graph using Breadth-First Search.

    Trees & Graphsbfsgraphshortest-pathhash-map
  • Heaps, Sorting & SearchMediumAuto-graded
    Pick the Rank-k Score From the Top

    Select the k-th largest value, counting duplicates separately, from an unsorted integer list without a full sort, using quickselect or a bounded heap.

    Heaps, Sorting & Searchquickselectheapselectionpartitioning
  • Trees & GraphsMediumAuto-graded
    Multi-Hop Currency Conversion Over a Rate Table

    Compute a conversion factor between two currencies by chaining and inverting listed rates, returning -1.0 when no chain exists; tests graph traversal with multiplicative weights.

    Trees & Graphsgraphbfshash-mapweighted-edges
  • Trees & GraphsMediumAuto-graded
    Suggest Top Social Connection

    Find the non-adjacent node in an undirected graph with the maximum count of shared neighbors relative to a target node.

    Trees & Graphsgraphsbfshash-tablesocial-network
  • Heaps, Sorting & SearchMediumAuto-graded
    Compute Safe Summary Statistics for Numeric Series

    Computes min, mean, and median robustly for floating-point data, handling missing/invalid values and large magnitude edge cases safely.

    Heaps, Sorting & Searchheaps-sortingarraysmath-bits
  • Data Structure DesignMediumModel answer
    BST In-Order Traversal Flow & Priority Queue Dispatcher

    Implement an in-order tree iterator with memory constrained by height, followed by a priority queue that handles multi-attribute ordering rules.

    Data Structure Designtreesstackheappriority-queue
  • Math & Bit ManipulationMediumModel answer
    Compute Courier Compensation for Delivery Trips

    Calculate total delivery earnings from start/end times and distances using conditional rates, rush-hour multipliers, and precision rules.

    Math & Bit Manipulationmathparsingsimulation
  • Dynamic ProgrammingMediumAuto-graded
    Prime Segment Partitions of a Digit Sequence

    Count the ways to cut a digit string into prime-valued pieces without leading zeros, using prefix dynamic programming plus a fast primality check, modulo 1,000,000,007.

    Dynamic Programmingdynamic-programmingprimality-teststringscounting
  • Math & Bit ManipulationEasyAuto-graded
    Token Hop Around a Ring

    Compute where a token lands on a ring after k escalating hops, which tests spotting a prefix-sum closed form with modular arithmetic instead of simulating.

    Math & Bit Manipulationmathmodular-arithmeticsimulationclosed-form
  • Arrays & HashingMediumAuto-graded
    Equicorrelation Floor, Reverse Slope, and Max-Min Covariance

    Combine three closed-form statistics results: the lowest shared correlation of three variables, a reverse regression slope from R² and a slope, and the covariance of the max and min of two uniforms.

    Arrays & Hashingcorrelationlinear-regressionorder-statisticscovariance
  • Heaps, Sorting & SearchMediumAuto-graded
    Running Leaderboard of the K Largest Readings

    Process paired operation and value lists, tracking the K largest integers seen so far and recording a descending snapshot after every operation, using a bounded min-heap.

    Heaps, Sorting & Searchheapstreamingtop-kpriority-queue
  • Data Structure DesignMediumAuto-graded
    Priority Job Scheduler with Cancellation

    Simulate a scheduler that adds, cancels, and runs jobs by priority with FIFO tie-breaking, using lazy deletion on a heap so each operation stays logarithmic.

    Data Structure Designheappriority-queuelazy-deletionhash-map
  • Arrays & HashingEasyAuto-graded
    Peak Request Load Over a Fixed Run of Minutes

    Find the largest total of any k consecutive values in a list, testing fixed-size sliding window technique and the ability to avoid recomputing overlapping sums.

    Arrays & Hashingsliding-windowarraysprefix-sum
  • Data Structure DesignMediumAuto-graded
    Subtree Access Rights Simulator for Advertiser Groups

    Simulate a log of grant, revoke and check operations on a rooted group tree, where a grant on a node also covers every node beneath it.

    Data Structure Designtreehash-setsimulationancestor-walk
  • Math & Bit ManipulationEasyAuto-graded
    Simple Interest Earned on a Short-Term Loan

    Compute the interest earned on a loan using a simple (non-compounding) annual percentage rate prorated over a number of months.

    Math & Bit Manipulationmathsimple-interestarithmeticfinance
  • Math & Bit ManipulationEasyAuto-graded
    Pricing Two Coin-Editing Tools in a Four-Coin Game

    Compute a baseline expected payoff and the fair prices of two coin-editing tools, using linearity of expectation, a parity invariant, and an absorbing-state argument.

    Math & Bit Manipulationprobabilityexpected-valueparity-invariantmarkov-chain
  • Trees & GraphsHardModel answer
    Shortest Hop Count Through a Flaky Web Graph

    Crawl a website graph from a start URL to an exit page using BFS, retrying transient 5xx failures a limited number of times, and return the minimum hop count or -1.

    Trees & Graphsbfsgraph-traversalretry-logicvisited-set
  • Stacks & QueuesMediumModel answer
    Arithmetic String Calculator with Operator Precedence

    Compute the integer result of a string holding non-negative numbers, four operators and spaces, honoring precedence and truncating division, without eval and with linear time.

    Stacks & Queuesparsingstackstringoperator-precedence
  • Trees & GraphsMediumAuto-graded
    Find the Best-Paid Sub-Organization by Mean Pay

    Aggregate subtree salary totals and headcounts bottom-up in a tree given as a flat list, then pick the best root using exact average comparison with size and id tie-breaks.

    Trees & Graphstreedfspost-ordertie-breaking
  • Data Structure DesignMediumModel answer
    Modeling a Multi-Car Lift Dispatcher with Swappable Policies

    Design an object-oriented lift (elevator) control system: classes, per-car state machine, stop ordering, pluggable dispatch, edge cases, and testable core logic.

    Data Structure Designobject-oriented-designstate-machinestrategy-patternsimulation
  • Data Structure DesignMediumAuto-graded
    Prepaid Compute Credit Tracker with Replay-Safe Events

    Simulate a per-tenant credit ledger driven by a command list, rejecting overdrafts and repeated event ids while tracking balances in a hash map and a set.

    Data Structure Designhash-mapsimulationidempotencydesign
  • StringsMediumAuto-graded
    Max Overlap of String Suffix and Prefix

    Find the maximum length of a suffix of one string that matches a prefix of another.

    Stringsstringskmpprefix-functiontwo-pointers
  • Stacks & QueuesMediumAuto-graded
    Expand Nested Repeat Notation into a Full String

    Expand a string containing nested count[text] repeat groups into its full form, using a stack or recursion to parse multi-digit counts and nesting correctly.

    Stacks & Queuesstackstring-parsingnested-structuresrecursion
  • Trees & GraphsHardAuto-graded
    Fewest Planks Across a Portal-Linked Board

    Find the cheapest route on a grid with free, paid and blocked cells plus same-numbered teleport cells, which calls for 0-1 BFS and care with teleport expansion.

    Trees & Graphs0-1 BFSshortest pathgridgraph modeling