KatInterview

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

Coding Interview 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 301–330 of 2119 results

  • Arrays & HashingMediumAuto-graded
    Group Paths Whose File Contents Match Exactly

    Group file paths whose contents are identical, using cheap filters like size and digest, with an exact comparison to confirm. Output is sorted groups of two or more paths.

    Arrays & Hashinghashinggroupingstringssorting
  • Greedy & IntervalsMediumAuto-graded
    Minimum Concurrent Resources for Overlapping Intervals

    Find the maximum number of overlapping intervals at any instant using sweep line or heap techniques.

    Greedy & Intervalsintervalssweep-lineheapsorting
  • Trees & GraphsEasyAuto-graded
    Nearest Shared Ancestor in an Array-Encoded Binary Tree

    Find the deepest node that is an ancestor of two given values in a binary tree stored as a heap-indexed array, using a parent map and ancestor walk.

    Trees & Graphsbinary-treelowest-common-ancestorbfshash-map
  • Math & Bit ManipulationEasyAuto-graded
    Shelf Stock Versus Random Demand in a Checkout Line

    Compute binomial probabilities that a limited stock covers random demand from a line of customers, both as at most M buyers and as exactly M buyers.

    Math & Bit Manipulationprobabilitybinomialcombinatoricsmath
  • Greedy & IntervalsMediumAuto-graded
    Largest Set of Compatible Time Slots on One Worker

    Find the largest subset of half-open time intervals that can run on one worker without overlap, testing greedy interval selection by earliest finish.

    Greedy & Intervalsgreedyintervalssorting
  • Greedy & IntervalsMediumAuto-graded
    Fewest Badges for a Row of Scored Players

    Greedy two-pass array problem: assign the minimum total badges so each player gets at least one and any player scoring higher than an adjacent player gets strictly more badges.

    Greedy & Intervalsgreedyarraytwo-passneighbors
  • Arrays & HashingEasyAuto-graded
    Filter Names Absent From a Blocklist After Cleanup

    Return the items of one string list whose trimmed, lowercased form is missing from a second list, keeping original spelling, order, and duplicates; tests hash sets and normalization.

    Arrays & Hashinghash-setstringsnormalizationfiltering
  • Trees & GraphsHardAuto-graded
    Schedule Tasks with Precedence Constraints

    Determine a valid sequential execution order for a set of tasks given dependency rules, or detect impossible circular dependencies.

    Trees & Graphstopological sortgraphbfsdegree count
  • Greedy & IntervalsMediumAuto-graded
    Courier Pay with Overlap Multipliers, Waits and Peak Windows

    Sweep-line over time intervals: pay grows with the square of concurrent deliveries, store-wait minutes are isolated, and peak windows double the rate.

    Greedy & Intervalssweep-lineintervalsevent-sortingsimulation
  • Greedy & IntervalsEasyAuto-graded
    Indices of Ranges Fully Inside a Query Range

    Scan a list of closed integer ranges and return the indices of those lying entirely within a given query range, testing inclusive boundary handling.

    Greedy & Intervalsintervalsarrayscanboundary-conditions
  • Data Structure DesignEasyAuto-graded
    Replay Operations on a Fixed-Capacity FIFO Buffer

    Simulate a bounded first-in-first-out buffer over a list of put and take commands, rejecting any command that would have to wait.

    Data Structure Designqueuesimulationdesignfifo
  • Trees & GraphsMediumAuto-graded
    Hub Node Pair Counting on a Weighted Tree with Divisible Distances

    Count, for each node of a weighted tree, the unordered pairs of other nodes at distances divisible by k and lying in different branches around that node.

    Trees & Graphstreedfscountingcombinatorics
  • Data Structure DesignEasyAuto-graded
    Field-Level Visibility Filter for Employee Records

    Build a function that returns only the employee record fields a viewer may see, based on admin status, identity, department, reporting line, and view type.

    Data Structure Designaccess-controldictionariessimulationrule-evaluation
  • Data Structure DesignMediumAuto-graded
    Sliding Log Window: Distinct Tags and Dominant Tag Since a Cutoff

    Replay operations on a bounded, timestamp-ordered log of the newest entries, answering cutoff queries with the distinct key count and the most frequent key (smallest on ties).

    Data Structure Designdesignhash-mapbinary-searchsliding-window
  • Linked ListsMediumAuto-graded
    Locate the Junction of Two Chains in a Successor Table

    Find the first node of one chain that also lies on a second chain, where both chains are encoded in a single successor array, or report -1 if they never converge.

    Linked Listslinked-listhash-settwo-pointersintersection
  • Heaps, Sorting & SearchEasyAuto-graded
    Permutation Search Sort: Order a List by Brute Force

    Implement a factorial-time sort that tries arrangements until one is non-decreasing, handling duplicates and empty input, and reason about its cost.

    Heaps, Sorting & Searchsortingpermutationsbrute-forcecomplexity-analysis
  • 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
  • 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
  • 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