KatInterview

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

Interview Practice Problems

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

5987
Problems
2219
Auto-graded
15
Topics
270
Added today

Showing 331–360 of 2219 results

  • 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
  • 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
  • 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
  • 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
  • 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
  • SQL & DataMediumAuto-graded
    Top Opening Film Across Subscriber Watch Logs

    Find each user's earliest-watched title, then pick the title that opens the most users' histories, using deterministic tie-breaking rules.

    SQL & Datahash-mapaggregationtie-breakinggroup-by
  • 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
  • SQL & DataMediumAuto-graded
    Cheapest Top-Rated Purchase per Category

    Join two tables as lists, filter on a strict rating threshold with missing values, and compute a per-group minimum with a default of 0 and sorted output.

    SQL & Dataaggregationleft-joinnull-handlinggroup-by
  • 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
  • Linked ListsEasyAuto-graded
    Exchange the Front Element with the k-th From the Back

    Tests index arithmetic and edge-case handling by swapping the first element of a sequence with its k-th element counted from the end, including the case where both are the same element.

    Linked Listslinked-listtwo-pointersswapedge-cases
  • Data Structure DesignMediumAuto-graded
    Card Settlement Batch with Fees, Rebates and Duplicate Guard

    Simulate a ledger: order card transactions by time, compute integer fee and rebate, enforce balance limits, and flag repeated transaction IDs.

    Data Structure Designsimulationsortinghash-setinteger-arithmetic
  • Heaps, Sorting & SearchMediumAuto-graded
    Deadline-Priority Ordering of Dependent Jobs

    Produce an execution order for jobs with prerequisites by always running the ready job with the earliest deadline, breaking ties by id, using topological sort with a heap.

    Heaps, Sorting & Searchtopological-sortheapgraphpriority-queue
  • Dynamic ProgrammingMediumAuto-graded
    Nearest Word Lookup Using Minimum Edit Operations

    Compute Levenshtein distance with dynamic programming and pick, for each query, the closest dictionary word with a stable first-index tie-break.

    Dynamic Programmingedit-distancedynamic-programmingstringstie-breaking
  • Dynamic ProgrammingMediumAuto-graded
    Counting Knight-Walk Phone Numbers on a Keypad

    Count length-n digit strings formed by knight jumps on a phone keypad, modulo 1e9+7, using DP over a small fixed graph.

    Dynamic Programmingdynamic-programminggraphmodular-arithmeticcounting
  • StringsMediumAuto-graded
    Fewest Front-Relocations to Rearrange a String

    Count the minimum moves to turn one string into another by moving characters to the front, using a multiset check and a right-to-left greedy subsequence match.

    Stringsstringsgreedytwo-pointerssubsequence
  • Stacks & QueuesEasyAuto-graded
    Check Block Nesting in a Flat Marker Sequence

    Scan a list of tokens and decide whether every OPEN-style marker is matched by a later close marker, using a running counter and early rejection.

    Stacks & Queuescounterbalanced-bracketssingle-passstrings
  • Arrays & HashingEasyAuto-graded
    Build a Route Map Request with Markers and Striped Segments

    Convert longitude-first route points into a map request with start and end markers and path groups of ten segments that alternate colors and share boundary points.

    Arrays & Hashingarraysgroupingtransformationdictionaries
  • Arrays & HashingMediumAuto-graded
    Bayesian Inference for Coin Flipping

    Evaluate posterior coin probabilities, posterior predictive likelihoods, and expected stopping times following observed heads.

    Arrays & Hashingprobabilitybayes-theoremexpected-valuebayesian-inference
  • Data Structure DesignMediumAuto-graded
    Deadline-First Job Queue with Prerequisite Gating

    Simulate a job queue where jobs unlock after their prerequisites are consumed, always serving the earliest-deadline unlocked job; tests heaps, dependency counting, and tie-breaking.

    Data Structure Designheaptopological-sortgraphsimulation
  • Data Structure DesignMediumAuto-graded
    Two-Tier Fixed-Window Request Throttle Simulator

    Simulate a throttle that enforces a shared limit and a per-key limit over epoch-aligned fixed windows, with lazy reset and a defined precedence between the two rejection reasons.

    Data Structure Designrate-limiterfixed-windowhash-mapsimulation
  • Trees & GraphsEasyAuto-graded
    Locate the Universally Followed Silent Guest

    Find the one node in a directed relation that everyone points to and that points to nobody, using a linear elimination pass followed by verification.

    Trees & Graphsgraphcelebrity-problemtwo-passelimination
  • Data Structure DesignEasyAuto-graded
    Simulate a Task Board with Id-Keyed Commands

    Process a batch of add, update, get and delete commands against an in-memory task store keyed by id, returning one result per command.

    Data Structure Designhash-mapsimulationdesigndictionary
  • Stacks & QueuesMediumAuto-graded
    Wait Time Until a Strictly Larger Sensor Value

    Find, for each position in a sequence, the distance to the next strictly larger element, using a monotonic stack to achieve linear time.

    Stacks & Queuesmonotonic-stackarraysnext-greater-element
  • Trees & GraphsMediumAuto-graded
    Teardown Sequencing with Nested Ownership and Extra Prerequisites

    Find the lexicographically smallest valid ordering of nodes under child-before-parent and extra precedence rules, or report impossibility when the rules contradict.

    Trees & Graphstopological-sortheapcycle-detectiongraph
  • SQL & DataEasyAuto-graded
    Daily Spend Ranking for Frequent Payers

    Filter users by total event count, then rank each user's payments within each calendar day by amount using competition ranking (ties share a rank, then a gap).

    SQL & Datawindow-functionsgroupingrankingsorting