KatInterview

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

Coding Interview Problems

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

5981
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 241–270 of 2765 results

  • Data Structure DesignMediumAuto-graded
    Live Complement Counting with Point Updates on One Array

    Answer repeated target-sum pair-count queries over two integer arrays while the second array receives point updates, using frequency maps.

    Data Structure Designhash-mapfrequency-countcounting-pairssimulation
  • Data Structure DesignMediumAuto-graded
    Ranked Staff Roster Across Multiple Forums with Swap-Down

    Simulate a batch of operations on per-forum ordered staff lists, enforcing seniority rules for adding, moving down one place, and removing members.

    Data Structure Designdesignhash-mapsimulationordered-list
  • Trees & GraphsMediumAuto-graded
    Sort a List and Replay Commands on a Binary Search Tree

    Sort an integer list without built-in sorting, then run a script of insert, search, delete and in-order commands on a duplicate-free binary search tree built from scratch.

    Trees & Graphsbinary-search-treequicksortrecursiontree-deletion
  • Data Structure DesignMediumModel answer
    Build a Heap Allocator with Fit Policies and Safe Handles

    Design a simulated memory manager over a fixed address range that supports two placement policies, splitting, merging of neighbors, and rejection of stale or forged release requests.

    Data Structure Designmemory-allocatorlinked-listhash-mapcoalescing
  • Arrays & HashingMediumAuto-graded
    Keep Words Whose Letter Multiset Appears More Than Once

    Filter a word list to the entries whose letter multiset is shared by at least two entries, keeping input order and duplicates, using letter-count keys.

    Arrays & Hashinghash-mapanagramscountingstrings
  • Arrays & HashingEasyAuto-graded
    Leaked Allocations: Filter Blocks Missing From Live Pointers

    Filter a list of allocated block addresses to those absent from a list of live pointers, keeping the original order, using hash-set membership for linear-time performance.

    Arrays & Hashinghash-setfilteringorder-preservationarrays
  • Trees & GraphsMediumAuto-graded
    Split Nodes Into Two Groups With No Internal Links

    Decide whether the vertices of an undirected multigraph can be split into two groups so every edge crosses between them, handling self-loops, repeated edges, and isolated nodes.

    Trees & Graphsgraphbfsbipartiteconnected-components
  • Math & Bit ManipulationMediumAuto-graded
    Integer Power via Repeated Squaring

    Compute a float raised to a signed 32-bit integer power in logarithmic time and constant space, handling negative exponents, zero bases and the most negative exponent.

    Math & Bit Manipulationbinary-exponentiationfloating-pointedge-casesiteration
  • Math & Bit ManipulationEasyAuto-graded
    Locate the Prime at a Given Position in the Prime Sequence

    Find the prime at a given 1-based position in ascending order, which tests sieving, bounding the search range, and complexity reasoning.

    Math & Bit Manipulationprimessievenumber-theorymath
  • Arrays & HashingHardModel answer
    Distinct Subset Sums With Negatives and Repeated Values

    List every distinct multiset of array values, each index used at most once, that sums to a target when negatives, zeros and duplicates are present. Output must be sorted.

    Arrays & Hashingbacktrackingpruningdeduplicationsubsets
  • Data Structure DesignMediumModel answer
    Build a CSR Container and Multiply It by a Dense Vector

    Design a class that compresses a mostly-zero integer matrix into three CSR arrays, then use it to compute a matrix-vector product in time proportional to the non-zero count.

    Data Structure Designsparse-matrixcsrmatrix-vector-multiplicationdata-structure-design
  • Arrays & HashingEasyAuto-graded
    Enumerate Every Settings Grid from Option Lists

    Build the Cartesian product of named option lists into a list of dictionaries, handling empty inputs and a defined output order.

    Arrays & Hashingcartesian-productbacktrackingitertoolsdictionaries
  • Data Structure DesignMediumModel answer
    Build a Polite Web Crawler with Letter-Coverage Ordering

    Design and implement a rate-limited article crawler that visits pages with unseen first letters before switching to random order, and explain how you would use an AI assistant to build it.

    Data Structure Designweb-crawlerrate-limitingfrontier-designai-pairing
  • Math & Bit ManipulationMediumAuto-graded
    Evaluate a Normalized CDF from Piecewise-Linear Density Samples

    Build a cumulative distribution from sampled density points using exact integration of a piecewise-linear curve, then answer many query points with correct boundary behavior.

    Math & Bit Manipulationnumerical-integrationbinary-searchprefix-sumsprobability
  • Data Structure DesignHardModel answer
    Bank Ledger with Holds, Expiring Transfers and Customer Merge

    Build an in-memory bank that supports deposits, payments, two-step transfers with expiring holds, a top-activity ranking, and customer merges that leave history untouched.

    Data Structure Designobject-oriented-designhash-mapheaplazy-expiry
  • Data Structure DesignMediumAuto-graded
    Flag Rule Resolver with Hash-Bucketed Rollouts

    Simulate a feature-flag service: match attribute rules, gate by a SHA-256 percentage bucket, and resolve conflicts so any matching "on" rule wins.

    Data Structure Designsimulationhashingrules-enginedesign
  • Arrays & HashingMediumAuto-graded
    Tally Orders per Customer by Status Column

    Group order records by customer and count how many fall into each requested status, producing one sorted, zero-filled row per customer.

    Arrays & Hashinghash-mapgroupingcountingsorting
  • Stacks & QueuesMediumAuto-graded
    Four-Function Calculator Without Parentheses

    Evaluate a string of non-negative integers with +, -, *, / and spaces, honoring precedence and truncating division toward zero, without using eval.

    Stacks & Queuesstring-parsingstackoperator-precedencesimulation
  • Data Structure DesignMediumModel answer
    Build a Minesweeper Engine That Scales to Huge Sparse Grids

    Design a Minesweeper class with board rendering and click handling via flood fill, then adapt it to enormous boards with few mines using lazy state and on-demand counting.

    Data Structure Designdesignflood-fillbfssparse-data-structures
  • Trees & GraphsMediumAuto-graded
    Fastest Signal Arrival Times Across a Relay Grid

    Compute shortest-path distances from one source in an undirected graph with non-negative weights, handling parallel edges, self-loops, and unreachable nodes.

    Trees & Graphsdijkstrashortest-pathgraphheap
  • Arrays & HashingMediumAuto-graded
    Richest Window of Stalls Under Count and Distance Limits

    Find the best sum over a contiguous run of position-sorted items, limited by item count and coordinate span, using sorting and a two-pointer sweep.

    Arrays & Hashingsliding-windowtwo-pointerssortingprefix-sums
  • Trees & GraphsHardAuto-graded
    Distinct Transitive Prerequisites in a Dependency DAG

    For each node in a DAG whose links may name unknown items, count the distinct nodes reachable along link direction, counting shared descendants once.

    Trees & Graphsgraphdagtopological-sortbitset
  • Trees & GraphsMediumAuto-graded
    Does This One-Way Network Contain a Loop?

    Decide whether a directed graph given as an adjacency list contains a cycle, handling self-loops, parallel edges, disconnected parts and an empty graph.

    Trees & Graphsgraphdirected-graphcycle-detectiontopological-sort
  • Heaps, Sorting & SearchMediumAuto-graded
    Find Earliest Compatible Release Version

    Find the smallest semantic version that satisfies a monotonic compatibility check while minimizing evaluations.

    Heaps, Sorting & Searchbinary-searchsortingarrays
  • Heaps, Sorting & SearchMediumAuto-graded
    Most Frequent Ads Within a Closed Time Range

    Select the K most frequent ad IDs among timestamped impressions in an inclusive window, breaking ties by smaller ID; tests binary search on sorted data plus counting and ordering.

    Heaps, Sorting & Searchbinary-searchhash-mapsortingsliding-window
  • Linked ListsEasyAuto-graded
    Filter Alternate Nodes in a Sequence

    Tests the ability to process a linear collection by dropping elements at even 1-based index positions.

    Linked Listslinked-listsarrayspointers
  • Math & Bit ManipulationEasyAuto-graded
    Compute Multi-User Feature Adoption Metrics

    Given population size and individual adoption probability, calculate key expectation, probability, and conditional probability metrics under Bernoulli assumptions.

    Math & Bit Manipulationmathprobabilitystatisticsnumerical-methods
  • Trees & GraphsMediumModel answer
    Mapping a Hidden Maze: Shortest Route for a Sensing Robot

    A robot in an unseen grid senses neighbours for free and pays per move. Find a shortest route to a target, or return to the start and report failure if none exists.

    Trees & Graphsbfsgridonline-explorationshortest-path
  • Greedy & IntervalsEasyAuto-graded
    Shift Pay Totals Across Time-of-Day Wage Bands

    Sum payouts for work sessions by intersecting each session with non-overlapping hourly wage bands, using interval overlap arithmetic.

    Greedy & Intervalsintervalsoverlapsimulationarrays
  • Trees & GraphsMediumModel answer
    Right Edge of a Tree and Minimal Bracket Removal

    Two linked tasks: list the nodes visible from the right of a binary tree, and delete the fewest parentheses from a string so the rest is balanced.

    Trees & Graphsbinary-treebfsstackstrings