KatInterview

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

Coding Interview Problems

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

6027
Problems
2232
Auto-graded
15
Topics
272
Added today

Showing 1771–1800 of 2785 results

  • Greedy & IntervalsMediumModel answer
    Assign Support Tickets to Agents Within Concurrency Limits

    Given a list of fixed-time support tickets, assign each to an agent while respecting per-client concurrency caps and an optional agent pool size.

    Greedy & Intervalsgreedyinterval-schedulingheapsweep-line
  • Heaps, Sorting & SearchMediumAuto-graded
    Collect minimum values with adjacent deletions

    Tests simulation using a priority queue with lazy deletion and a linked list to repeatedly remove the smallest remaining element and its current neighbors.

    Heaps, Sorting & Searchheaplinked-listsimulationlazy-deletion
  • Data Structure DesignMediumAuto-graded
    Filter Stream Events by Registered Patterns

    Tests inverted index design and set-based matching to efficiently find which registered word patterns are satisfied by incoming events.

    Data Structure Designhash-tablessetsinverted-index
  • Data Structure DesignMediumAuto-graded
    Frequency-Based Cache Eviction

    Build a cache that tracks access counts and evicts the least-used item, breaking ties by recency, all in constant time.

    Data Structure Designhash-mapdoubly-linked-listcachedesign
  • Arrays & HashingHardModel answer
    Fewest Swaps to Bring an Array with Duplicates into Sorted Order

    Given an integer array that may contain duplicates, find the minimum number of arbitrary index swaps needed to sort it in non-decreasing order.

    Arrays & Hashingsortingpermutationscycle-detectiongreedy
  • Math & Bit ManipulationMediumModel answer
    Bounded Robot Path Under Infinite Command Repeats

    Simulate one pass of a compressed command string, then decide whether infinitely repeating it keeps the robot inside a finite region, even with obstacles.

    Math & Bit Manipulationsimulationcycle-detectiongeometrystate-machine
  • Arrays & HashingMediumModel answer
    Peak Average Score: Overflow, Large Files, and Java Concurrency

    Aggregate student scores to find the highest per-student average, then extend the solution for huge files, negative values, integer overflow, and multithreaded processing.

    Arrays & Hashingjavaconcurrencyaggregationinteger-overflow
  • Dynamic ProgrammingMediumAuto-graded
    Minimize Payment Transfers to Balance Group Accounts

    Tests backtracking with memoization to find the smallest number of payments needed to settle net balances across multiple participants.

    Dynamic Programmingbacktrackingmemoizationcombinatorial-search
  • Data Structure DesignMediumAuto-graded
    Score Tracker with Ranking and Top-K Queries

    Tests the ability to maintain ordered scores with efficient updates and rank lookups using augmented balanced search trees.

    Data Structure Designbinary-search-treeorder-statisticsdata-structures
  • Data Structure DesignMediumAuto-graded
    Versioned Key-Value Log with Point-in-Time Reads

    Tests per-key version tracking and efficient predecessor search to retrieve the most recent value written at or before any queried timestamp.

    Data Structure Designbinary searchhash mapversioning
  • Trees & GraphsHardModel answer
    Check Whether a Node Sequence Is a Valid BFS on a Tree

    Given an undirected tree and multiple permutations of its nodes, determine for each permutation whether it could be the dequeue order of some BFS starting at its first element.

    Trees & GraphsBFStreessimulationhashing
  • Dynamic ProgrammingHardAuto-graded
    Expected Steps to Deplete Whole Pills from a Random Draw Process

    Tests modeling a stochastic process as a Markov chain and solving it with dynamic programming using conditional expectation.

    Dynamic Programmingprobabilityexpectationmarkov-chainrecurrence
  • Data Structure DesignHardModel answer
    Mutable Integer Set with Freeze-Frame Iterators

    Design an integer set supporting O(1) add/remove/contains plus snapshot iterators that capture insertion-order state at creation time without copying.

    Data Structure Designsnapshotsiteratorsappend-only logversioning
  • Data Structure DesignMediumModel answer
    Build a Path-Addressed Tree Store and a Bounded Ring Buffer

    Design an in-memory hierarchical path store with strict parent-existence errors, plus a fixed-capacity FIFO queue where every operation is constant time.

    Data Structure Designtriehash-mapcircular-bufferapi-design
  • Arrays & HashingMediumModel answer
    Simulating Motion Under Time-Varying Visibility Constraints

    Determine how many entities moving rightward on a line reach a target position when their movement is blocked by a direction-switching observer.

    Arrays & Hashingsimulationbinary-searchprefix-sum
  • Trees & GraphsMediumModel answer
    Height-Balanced Nodes in Heap-Array Trees

    Traverse a binary tree stored in heap-index layout to find every node whose subtree is height-balanced, returning each with its tree level.

    Trees & Graphsbinary-treepost-orderheap-layoutbottom-up
  • Greedy & IntervalsMediumModel answer
    Minimum Shift Count for Concurrent Task Scheduling

    Given tasks with time windows and resource demands, find the fewest parallel workers needed so no worker exceeds capacity K at any moment.

    Greedy & Intervalsgreedyintervalsheapbin-packing
  • Data Structure DesignMediumAuto-graded
    Access-Tracked Key-Value Store

    Build a dictionary that counts how many times each key has been retrieved, testing hash map design and state management.

    Data Structure Designhash-mapdesignsimulation
  • Arrays & HashingMediumAuto-graded
    Instrument-Based Estimator for a Randomized Encouragement Trial

    Tests whether a candidate can implement ITT, first-stage, and IV/Wald (LATE) estimators from a randomized encouragement design, including a balance check on pre-treatment activity.

    Arrays & Hashingcausal-inferencea-b-testinginstrumental-variables
  • Data Structure DesignMediumModel answer
    In-Memory Grid with Formula Evaluation and Cycle Guards

    Build a spreadsheet class in three stages: plain integer cells, formula parsing with dependency-order evaluation, then cycle detection and targeted recomputation.

    Data Structure Designgraphsdependency-trackingparsing
  • Data Structure DesignHardModel answer
    Peak Concurrent Couriers Over a Rolling 24-Hour Window

    Design a data structure that records courier delivery intervals and efficiently answers: what is the highest number of couriers simultaneously active at any instant in the last 24 hours?

    Data Structure Designsegment-treeintervalssliding-windowonline-algorithms
  • Data Structure DesignMediumAuto-graded
    Round-Robin Load Balancer with Capacity and Shutdown

    Tests stateful system simulation with round-robin target selection, connection lifecycle tracking, capacity enforcement, and target shutdown with eviction ordering.

    Data Structure Designsimulationhash-tableround-robinstateful
  • Data Structure DesignMediumAuto-graded
    Disjoint Set: Merge Nodes and Query Connectivity

    Tests ability to implement Union-Find with union by rank and path compression, supporting merge, connectivity, and component-count queries.

    Data Structure Designunion-finddisjoint-setgraphdata-structure-design
  • Arrays & HashingMediumAuto-graded
    Deduplicate Coordinate List with Index Mapping

    Tests the ability to extract distinct elements while preserving first-occurrence order and building an index array for reconstruction.

    Arrays & Hashinghashingdeduplicationindexing
  • Trees & GraphsMediumAuto-graded
    Place One Beacon to Minimize Peak Shadow Distance

    Tests binary search on a monotone feasibility predicate combined with multi-source BFS and Chebyshev distance geometry on a 2-D grid.

    Trees & Graphsbfsbinary-searchgrid
  • Trees & GraphsMediumAuto-graded
    Recursive Region Tree and Safe Graph Nodes

    Tests recursive spatial subdivision (quadtree construction) and graph cycle detection (identifying nodes that always terminate).

    Trees & Graphsrecursiongraphsdivide-and-conquertopological-sort
  • Arrays & HashingMediumAuto-graded
    Alternating Chain Assembly from Both Ends

    Tests two-pointer simulation with alternating turns, conditional greedy selection rules, tie-breaking logic, and strict-increase constraints.

    Arrays & Hashingsimulationtwo-pointersarrays
  • Data Structure DesignHardModel answer
    Building Map and Filter from a Reduce Foundation

    Implement a reduce operation, then express map and filter purely in terms of that reducer without independent iteration.

    Data Structure Designhigher-order-functionsfunctional-programmingdata-structures
  • Data Structure DesignHardAuto-graded
    IP Access Control with CIDR Matching

    Tests binary trie implementation for efficient IP prefix matching with CIDR notation and rule subsumption optimization.

    Data Structure Designtriebit-manipulationnetwork-programming
  • Trees & GraphsMediumAuto-graded
    Convert Nested Dictionary to Dot-Separated Keys

    Tests ability to traverse nested data structures and transform hierarchical key-value pairs into a flat representation using path notation.

    Trees & Graphsrecursioniterationdictionarytree-traversal