KatInterview

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

Coding Interview Problems

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

6035
Problems
2235
Auto-graded
15
Topics
274
Added today

Showing 1681–1710 of 2788 results

  • Data Structure DesignMediumModel answer
    Build a Thread-Safe Token Bucket Rate Limiter

    Implement a token bucket that refills lazily on each admission attempt, handles concurrent callers safely, and supports both non-blocking and timeout-bounded acquisition.

    Data Structure Designconcurrencyrate-limitingsynchronization
  • StringsMediumModel answer
    Build a POSIX Shell Script with Validation and Structured Output

    Write a strict POSIX sh script that validates arguments, reads a file, extracts a license string, and prints a formatted timestamped line.

    StringsshellPOSIXCLIerror-handling
  • Trees & GraphsMediumAuto-graded
    Bottleneck Path Under an Edge-Weight Cap

    Tests whether a candidate can find the minimax-cost path in a filtered graph, recognising that one edge attribute gates inclusion while another drives the optimisation.

    Trees & Graphsgraphdijkstraminimaxshortest-path
  • Trees & GraphsMediumModel answer
    Collapsible Nested Menu with ARIA Support

    Design and code a React component that displays hierarchical data with interactive expand/collapse behavior and full keyboard accessibility.

    Trees & Graphsreactrecursionaccessibilitystate-management
  • Arrays & HashingMediumAuto-graded
    Three-Dice Payout: Expected Value by Match Type

    Tests ability to count outcome classes for three N-sided dice and combine probability-weighted payoffs into an expected value, including a sign-flip variant.

    Arrays & Hashingexpected-valueprobabilitycounting
  • Data Structure DesignMediumAuto-graded
    Bounded Cache with Least-Recently-Used Eviction

    Simulate a capacity-limited key–value cache where lookups and writes both refresh recency and the oldest entry is evicted on overflow.

    Data Structure Designhash-maplinked-listcachesimulation
  • StringsMediumAuto-graded
    Letter Tile Scorer for a Word-Guessing Game

    Tests whether you can implement a precise per-letter color-scoring rule — including count-limited yellow matching — across a list of guesses against a fixed target word.

    Stringsstringsarrayshashing
  • Math & Bit ManipulationEasyAuto-graded
    Compute Tax Using Marginal Brackets

    Tests understanding of piecewise rate application and interval-based accumulation in a tiered tax system.

    Math & Bit Manipulationsimulationmathiteration
  • Trees & GraphsMediumAuto-graded
    Letter Access Sets Through a Dependency Graph

    Tests topological processing of a DAG where each node computes an active letter set from its parents' resolved sets plus its own additions and removals.

    Trees & Graphstopological-sortbit-manipulationgraph
  • Arrays & HashingMediumAuto-graded
    K-Means Clustering: Assignment, Update, and Convergence

    Tests ability to implement the full k-means loop — initialization, Euclidean assignment, centroid update, convergence check, and empty-cluster handling — in plain Python.

    Arrays & Hashingclusteringiterative-algorithmsnumerical
  • Arrays & HashingMediumAuto-graded
    Align Time Series with Linear Interpolation

    Tests piecewise-linear interpolation, binary search, and boundary handling for sampling two time series at common timestamps.

    Arrays & Hashinginterpolationbinary-searchtime-series
  • Data Structure DesignMediumModel answer
    Concurrent Data Structures and Calendar Scheduling

    Build thread-safe request throttling, search from scratch, frequency-ranked retrieval, and multi-calendar availability finder.

    Data Structure Designconcurrencydata-structuresalgorithmsscheduling
  • Trees & GraphsMediumAuto-graded
    Flood Fill with Step Budget on an 8-Connected Grid

    Tests BFS-based grid traversal by counting distinct empty cells reachable from a starting position within a fixed number of 8-directional moves.

    Trees & Graphsbfsgridgraph-traversal
  • Greedy & IntervalsMediumAuto-graded
    Union Length of Half-Open Integer Intervals

    Merge overlapping half-open intervals to return the total length covered by at least one interval.

    Greedy & Intervalsintervalssortingsweep-linemerge
  • Arrays & HashingMediumAuto-graded
    Profit, Collinearity, and Identity Merging in Three Parts

    Tests one-pass array scanning, integer-arithmetic collinear point detection, and union-find graph component grouping in a single combined function.

    Arrays & Hashingarraysmathunion-find
  • Dynamic ProgrammingMediumAuto-graded
    Minimum Coins to Reach a Money Amount

    Tests dynamic programming on a coin-change problem where decimal monetary values must be safely converted to integers before solving.

    Dynamic Programmingdynamic-programmingdecimal-precisioncoin-change
  • StringsMediumAuto-graded
    Reversible String List Serializer

    Tests whether a candidate can design a lossless encode/decode round-trip for arbitrary strings without relying on a fixed delimiter character.

    Stringsstringsserializationencoding
  • Trees & GraphsEasyAuto-graded
    Tree Traversal with Depth Tracking

    Tests your ability to perform pre-order depth-first traversal on a tree structure and track hierarchical depth for each node.

    Trees & Graphstree-traversaldfsdepth-tracking
  • StringsMediumModel answer
    Find Optimal Single Digit Exchange to Maximize Value

    Swap at most two digits in a non-negative integer to achieve the largest possible result.

    Stringsgreedystring-manipulationoptimization
  • Data Structure DesignMediumModel answer
    Build a Multi-Key Task Queue with Ordering and Concurrency Control

    Create a thread-safe task scheduler that runs tasks sequentially per key while respecting a global worker limit and capacity bound.

    Data Structure Designconcurrencythreadingqueuesynchronization
  • Trees & GraphsMediumModel answer
    Threaded Comment Feed: Filtering, Nesting, and Persistent Sort

    Transform a flat array of comments into a sorted, nested, filterable tree while persisting the user's sort preference across sessions.

    Trees & Graphstree-constructiondfslocalStoragefrontend-data
  • Data Structure DesignMediumAuto-graded
    Batch Spreadsheet Cell Evaluator with Cycle Rejection

    Simulate setting and reading spreadsheet cells whose values are integers or sums of references, evaluating lazily and rejecting updates that would form cycles.

    Data Structure Designgraphscycle-detectionexpression-evaluationdependency-tracking
  • Data Structure DesignMediumModel answer
    Multiset with O(1) Insert, Delete, and Uniform Random Sampling

    Build a collection supporting duplicates with constant-time insertion, deletion, and uniform random selection from all stored occurrences.

    Data Structure Designdata-structureshash-tablesrandomization
  • Trees & GraphsMediumAuto-graded
    Shared Root of Two Nodes in a Binary Search Tree

    Tests whether a candidate can exploit BST ordering to locate the deepest node that is an ancestor of both targets without searching the entire tree.

    Trees & Graphsbinary-search-treelowest-common-ancestortree-traversal
  • Trees & GraphsMediumAuto-graded
    Left and Right View of a Binary Tree Using BFS and DFS

    Tests understanding of binary tree traversal by computing boundary nodes at each depth using both breadth-first and depth-first strategies.

    Trees & Graphsbinary-treebfsdfstree-traversal
  • Data Structure DesignMediumModel answer
    Two-Tier API Rate Limiter with a Sliding Window

    Design a thread-safe rate limiter that enforces both a per-endpoint quota and a shared global quota using a rolling time window.

    Data Structure Designrate-limitingconcurrencysliding-windowthread-safety
  • Data Structure DesignMediumModel answer
    Build a Reference-Counted Shared Ownership Pointer in C++

    Implement a thread-safe shared ownership smart pointer class template from scratch, covering copy/move semantics, atomic reference counting, and correct destruction.

    Data Structure Designc++memory-managementconcurrency
  • Heaps, Sorting & SearchHardAuto-graded
    Minimum Lexicographic Sequence with Precedence Constraints

    Find the smallest valid ordering of numbered items when some must precede others, or detect when circular dependencies make ordering impossible.

    Heaps, Sorting & Searchtopological-sortgraphheapgreedy
  • Dynamic ProgrammingMediumAuto-graded
    Largest Sum in Any Consecutive Sequence

    Tests understanding of dynamic programming through finding the maximum sum achievable by selecting adjacent elements from an array.

    Dynamic Programmingarrayskadanesubarrayoptimization
  • Data Structure DesignMediumAuto-graded
    Freelance Crew Pay Tracker With Rolling Settlements

    Tests the ability to design an in-memory ledger class driven by an operation list, maintaining running cost totals and an idempotent pay-cutoff pointer.

    Data Structure Designdesignsimulationhash-map