KatInterview

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

Coding Interview Problems

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

5993
Problems
2220
Auto-graded
15
Topics
270
Added today

Showing 391–420 of 2120 results

  • Arrays & HashingEasyAuto-graded
    Determine Highest Single Transaction Stock Profit

    Find the maximum gain possible from buying and selling a stock once, given a sequence of daily values.

    Arrays & Hashingarraysgreedydynamic-programming
  • Heaps, Sorting & SearchMediumAuto-graded
    Smallest Conveyor Load Limit for Sequential Parcels

    Find the minimum per-day load limit that moves an ordered list of parcels in at most a given number of days, using binary search on the answer with a greedy feasibility check.

    Heaps, Sorting & Searchbinary-searchgreedysearch-on-answerarrays
  • StringsEasyAuto-graded
    Encode Keypad Multi-Tap Strokes

    Simulate telephone keypad multi-tap text encoding while inserting pause delimiters for consecutive letters on the same digit key.

    Stringsstringshash-tablesimulation
  • Arrays & HashingMediumAuto-graded
    Subarrays Whose Matching-Element Count Hits a Residue

    Count subarrays where the number of elements congruent to a residue, taken modulo the same base, equals that residue, using prefix remainders and a frequency table.

    Arrays & Hashingprefix-sumhash-mapmodular-arithmeticsubarrays
  • 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
  • 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 & 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 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
  • Trees & GraphsMediumAuto-graded
    Collect Every Value Stored Under a Key in Nested Data

    Walk a nested structure of dicts and lists depth-first and gather every value stored under a given key, in traversal order, including matches inside already-matched values.

    Trees & Graphsrecursiondfsjsontraversal