KatInterview

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

Coding Interview Problems

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

6037
Problems
2236
Auto-graded
15
Topics
273
Added today

Showing 1171–1200 of 2789 results

  • Arrays & HashingEasyAuto-graded
    Find Minimum and Mode of an Integer Array

    Find the minimum element and the most frequent element (mode) in an unsorted list of integers.

    Arrays & Hashingarrayshash-tablefrequency-counting
  • Trees & GraphsHardAuto-graded
    Calculate Subtree Totals in a Tree

    Given an undirected tree and node weights, compute the sum of values for every subtree rooted at node 1.

    Trees & Graphstrees-graphsdfstree-traversalbottom-up
  • Math & Bit ManipulationMediumAuto-graded
    Chance a Daily +/- Walk Ends Below Zero

    Model a price as a two-step random walk, reduce it to a binomial lower tail with a strict cutoff, and sum that tail in a numerically stable way.

    Math & Bit Manipulationprobabilitybinomialnumerical-stabilityrandom-walk
  • Trees & GraphsEasyAuto-graded
    Extract Sorted Values from Level-Order Encoded BST

    Extract all valid integer elements from a level-order serialized binary search tree and return them in non-decreasing order.

    Trees & Graphstrees-graphsheaps-sortingbinary-search-tree
  • Trees & GraphsMediumAuto-graded
    Best Net Reward Route to an Underscore Node in a DAG

    Find the highest net score of a route in a weighted DAG that ends at a node whose name starts with an underscore, using topological order and DP.

    Trees & Graphsgraphdagtopological-sortdynamic-programming
  • Greedy & IntervalsMediumModel answer
    Matrix 90-Degree Clockwise Rotation and Maximum Interval Coverage

    Rotate a square grid 90 degrees clockwise and identify regions of maximal overlapping intervals using a sweep-line algorithm.

    Greedy & Intervalsarraysgreedy-intervalsheaps-sorting
  • Data Structure DesignMediumAuto-graded
    Identify Winning Move in Bottom-Inserted Drop Game

    Simulate a custom grid game with bottom-insertion pushes to detect the earliest turn that forms a line of length k.

    Data Structure Designarrayshash-tablesimulationdesign-ds
  • Arrays & HashingEasyAuto-graded
    Reverse Array Segment Between First Two Target Occurrences

    Reverse the subsegment of an array from the first occurrence of a target value up to its second occurrence.

    Arrays & Hashingarraystwo-pointersslicing
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Expected Score from Multi-Stage Die Rerolls

    Computes the optimal decision threshold and overall expected payoff when given one optional reroll on an N-sided die.

    Math & Bit Manipulationmathprobabilityexpected-valuedynamic-programming
  • Math & Bit ManipulationEasyAuto-graded
    Determine Animal Quantities in a Barn

    Find the integer count of each animal species given the total legs and proportional species constraints.

    Math & Bit Manipulationmathalgebra
  • Data Structure DesignMediumModel answer
    Thread-Safe Recurring Task Engine

    Design and implement a concurrent background scheduler that manages recurring execution intervals, supports execution cancellation, and handles thread-safe termination.

    Data Structure Designconcurrencyheapsthreadsdesign
  • Stacks & QueuesMediumAuto-graded
    Rounds of Pruning in a Garden Row

    Count how many rounds of simultaneous removals occur in a row of numbers where each element larger than its left neighbor is removed, using a monotonic stack to beat quadratic simulation.

    Stacks & Queuesmonotonic-stacksimulationarraysamortized-analysis
  • Math & Bit ManipulationMediumAuto-graded
    Maximize Disjoint Letter Coverage

    Find the maximum count of distinct letters that can be collected by picking a mutually disjoint subset of strings.

    Math & Bit Manipulationbit-manipulationbacktrackingdynamic-programmingstrings
  • Trees & GraphsMediumAuto-graded
    Common Ancestor of Two Values, Only If Both Exist

    Find the lowest common ancestor of two values in a level-order encoded binary tree, returning null when either value is missing from the tree.

    Trees & Graphsbinary-treelowest-common-ancestorparent-mapbfs
  • Trees & GraphsMediumAuto-graded
    Maximum Subtree Weight for Every Node in a Network

    Find the maximum sum of a connected component containing each node in an undirected tree using dynamic programming with rerooting.

    Trees & Graphstrees-graphsdynamic-programmingtree-dprerooting-dp
  • Math & Bit ManipulationHardModel answer
    Numbers with Double Sum-of-Squares Decompositions

    Count unique pairs of non-negative integers whose squares sum to a target value, identifying numbers with exactly two representations up to a limit N.

    Math & Bit Manipulationmath-bitsarraysmath
  • Arrays & HashingMediumAuto-graded
    Runners on a Road Frozen by a Sweeping Guard

    Simulate runners advancing along a road while a guard turns at given seconds and freezes anyone in view, using parity of duplicate turn times and strict event ordering.

    Arrays & Hashingsimulationhash-mapcountingparity
  • Stacks & QueuesMediumAuto-graded
    Widest Span Between Two Dominating Ends

    Find the longest subarray whose two end values are each strictly larger than everything between them, using a monotonic stack to avoid checking all pairs.

    Stacks & Queuesmonotonic-stackarraysnearest-greateramortized-analysis
  • StringsEasyAuto-graded
    Fill In Percent-Delimited Tokens From a Lookup Table

    Scan a string left to right, replacing each %key% token with its mapped value and returning None when a key is missing; tests careful linear string parsing.

    Stringsstringsparsinghash-maptwo-pointers
  • Heaps, Sorting & SearchMediumModel answer
    Minimize Black-Box Unimodal Function Without Derivatives

    Find the minimum of a convex/unimodal function over continuous and discrete intervals using zero-order optimization.

    Heaps, Sorting & Searchbinary searchoptimizationunimodalgolden section
  • Trees & GraphsMediumModel answer
    Evaluate Grid Path Feasibility and Identify Top K Elements

    Determine matrix path reachability under obstacle constraints and extract the k most frequent elements from an array.

    Trees & Graphstrees-graphsheaps-sortingarrays
  • Data Structure DesignMediumModel answer
    Pluggable Filter and Scoring Pipeline for Ticket Listings

    Design an extensible object-oriented engine that drops ineligible events with pluggable rules, then orders the rest by a weighted blend of scoring strategies.

    Data Structure Designobject-oriented-designstrategy-patternopen-closed-principlesorting
  • Greedy & IntervalsMediumAuto-graded
    Insert and Merge Interval into Sorted Collection

    Incorporate a target range into an already sorted list of disjoint closed intervals, merging any overlapping or adjacent spans in linear time.

    Greedy & Intervalsintervalsarraysgreedy
  • Data Structure DesignMediumAuto-graded
    Replay a Bounded Recency Store from an Operation Log

    Simulate a fixed-size store that discards its stalest entry on overflow, answering lookups in O(1) each by pairing a hash map with a doubly linked list.

    Data Structure Designhash-mapdoubly-linked-listlru-cachesimulation
  • Heaps, Sorting & SearchMediumAuto-graded
    Where Is the Traveler? Locate by Timestamp from Trip Logs

    Answer timestamp queries against unsorted trip intervals using sorting and binary search, handling closed boundaries, gaps between trips, and times before the first trip.

    Heaps, Sorting & Searchbinary-searchsortingintervalssimulation
  • Data Structure DesignMediumModel answer
    Detect Duplicate Files Safely and Efficiently

    Design a filesystem duplicate finder that guards against infinite loops, avoids loading whole files into memory, and applies multi-stage filtering to minimize disk reads.

    Data Structure Designfilesystemhashingio-optimizationtraversal
  • Arrays & HashingEasyAuto-graded
    Push Zeros Left While Keeping Other Values in Order

    Rearrange an integer list in place so all zeros come first and the non-zero values keep their original relative order, using a right-to-left two-pointer pass.

    Arrays & Hashingarraystwo-pointersin-place
  • Arrays & HashingMediumAuto-graded
    Four-Position Target Sum Finder Preserving Original Indices

    Find all increasing index quadruples whose values add up to a target, treating equal values at different positions as distinct answers; tests hashing pair sums and ordering.

    Arrays & Hashinghash-mapmeet-in-the-middlek-sumindices
  • Math & Bit ManipulationEasyAuto-graded
    Simulate Account Transactions with Integer Cashbacks

    Process a series of deposits, conditional withdrawals, and integer floor cashbacks to compute a final account balance.

    Math & Bit Manipulationsimulationmatharrays
  • Trees & GraphsMediumAuto-graded
    Referral Credit Ledger with Multilevel Propagation

    Simulate account additions, referral bonus propagation (direct or indirect), and threshold queries ordered deterministically.

    Trees & Graphstrees-graphsarraysdesign-ds