KatInterview

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

Interview Practice 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 421–450 of 2220 results

  • 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
  • Math & Bit ManipulationMediumAuto-graded
    Bitwise Quotient Without Multiply, Divide, or Modulo

    Compute a truncated 32-bit signed integer quotient using only shifts, addition and subtraction, handling the single overflow case and sign rules efficiently.

    Math & Bit Manipulationbit-manipulationmathbinary-searchoverflow
  • Data Structure DesignMediumAuto-graded
    Lantern Posts and Open Stretch Checks Along a Highway

    Process interleaved insert and query events on sparse integer coordinates, checking whether a symmetric window contains any previously inserted point, using binary search and a Fenwick tree.

    Data Structure Designfenwick-treebinary-searchcoordinate-compressionrange-query
  • Heaps, Sorting & SearchMediumAuto-graded
    Locate the Lone Value in a Sorted Paired List

    Use parity-based binary search on a sorted array of duplicated values to find the one value without a partner in logarithmic time and constant extra space.

    Heaps, Sorting & Searchbinary-searchsorted-arrayparityarrays
  • Math & Bit ManipulationMediumAuto-graded
    Pick Non-Overlapping Words to Cover the Most Letters

    Choose a subset of words with no shared letters so the number of distinct letters covered is maximal, which suits bitmask encoding and subset search.

    Math & Bit Manipulationbitmaskbacktrackingsubsetsstrings
  • Heaps, Sorting & SearchMediumAuto-graded
    Shortest-Stack Block Placement Order

    Simulate placing blocks one at a time onto the currently lowest of k stacks, with ties going to the lowest index, and report each chosen stack; tests heap-based greedy simulation.

    Heaps, Sorting & Searchheappriority-queuegreedysimulation
  • StringsEasyAuto-graded
    Stitch Glyph Rows Into a Banner

    Combine per-character row strings from a font table into banner lines by joining row i of every glyph in order.

    Stringsstringssimulationhash-mapjoin
  • Arrays & HashingMediumAuto-graded
    Maximum Consecutive Ones With a Single Bit Repair

    Find the longest stretch of 1s achievable in a binary list when at most one 0 may be changed to 1, using a two-pointer window that tolerates one zero.

    Arrays & Hashingsliding-windowtwo-pointersbinary-array
  • Arrays & HashingEasyAuto-graded
    Financial Payback and Sensitivity Analysis for Renewable Energy

    Perform quantitative financial modeling and sensitivity analysis for renewable energy pilot projects.

    Arrays & Hashingfinancesensitivity-analysismathstatistics
  • StringsMediumAuto-graded
    Evaluate Arithmetic String Without Parentheses

    Parse and compute a non-negative integer arithmetic string with basic binary operators while preserving standard precedence and left-to-right evaluation.

    Stringsstringsparsingstacks-queuesmath-bits
  • Data Structure DesignMediumAuto-graded
    Latest-Wins Priority Job Runner Simulation

    Simulate a job runner where resubmitting an ID overrides its earlier entry, testing heap-based lazy deletion with tie-breaking and run-once rules.

    Data Structure Designheaplazy-deletionsimulationhash-map