KatInterview

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

Coding Interview Problems

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

5978
Problems
2214
Auto-graded
15
Topics
272
Added today

Showing 481–510 of 650 results

  • StringsMediumModel answer
    Extract and Safely Parse an XML Document Nested in CDATA

    Implement a function that pulls a nested XML document out of a CDATA section and reads an attribute from its root, while blocking XXE and entity-expansion attacks.

    Stringsxmlsecurityparsing
  • Math & Bit ManipulationMediumModel answer
    Build a [0,1) Sampler from Fair Coin Flips

    Design an algorithm that uses a fair-bit source to produce a number uniformly distributed on [0,1), and analyze its error and cost.

    Math & Bit Manipulationprobabilityrandomized-algorithmsbit-manipulationfloating-point
  • Math & Bit ManipulationMediumModel answer
    Integer Sequence Rule Inference and Next-Term Prediction

    Design a systematic program that detects the governing rule of an integer sequence and predicts the next k terms, ranked by plausibility.

    Math & Bit Manipulationpattern-recognitionmodel-selectionfinite-differencesrecurrences
  • Data Structure DesignMediumModel answer
    Path Template Router with Variables and Wildcard Tails

    Build a trie-based URL router that registers templates with named captures and wildcard tails, resolves concrete paths with literal-first precedence and backtracking, and detects shape conflicts.

    Data Structure Designtrieroutingbacktrackingdesign
  • Data Structure DesignMediumModel answer
    Company Hierarchy Query System with Dynamic Updates

    Build a data structure to efficiently query employee roles and reporting counts in a company hierarchy, then extend it to handle dynamic additions.

    Data Structure Designtreesgraphspreprocessingaggregation
  • Trees & GraphsEasyModel answer
    Path Sum Validation in Binary Trees

    Determine whether any root-to-leaf path in a binary tree sums to a given target value.

    Trees & Graphsbinary-treedepth-first-searchtree-traversal
  • StringsEasyModel answer
    Log Ingestion Engine with Prefix-Operator Query Filtering

    Build a two-phase pipeline that parses raw server log lines into structured records and filters them using a mini query language of typed prefix tokens.

    Stringsparsingregexfilteringdesign
  • Data Structure DesignHardModel answer
    Greedy Text Tokenizer with Vocabulary Trie

    Build a tokenizer that greedily matches the longest vocabulary token at each position, handling unknown characters with optional span merging.

    Data Structure Designtriestring-matchingtokenizationgreedy-algorithms
  • StringsMediumModel answer
    Build a Holiday Gift Matcher from CSV Input

    Parse participant data from a CSV string with quoted fields, validate entries, and create a round-robin assignment where no one gives a gift to themselves.

    Stringsparsingvalidationalgorithmscsv
  • Trees & GraphsMediumModel answer
    Cluster Exposures: Net Change per Asset Group

    Find connected components in an asset correlation graph and return the summed position delta for each component as a labeled group.

    Trees & Graphsgraph traversalconnected componentshash mapDFS
  • Data Structure DesignMediumModel answer
    Duplicate-Aware Collection with O(1) Random Sampling

    Design a multiset supporting insert, remove, and uniform random sampling over all occurrences, each in expected O(1) time.

    Data Structure Designhash-maparrayrandomnessdata-structure-design
  • Heaps, Sorting & SearchHardModel answer
    Locate Local Minima Using Divide-and-Conquer

    Implement sublinear algorithms to identify a local minimum in a 1D array and a 2D grid by applying binary search to unimodal descent.

    Heaps, Sorting & Searchbinary-searchdivide-and-conqueralgorithms
  • Data Structure DesignEasyModel answer
    Two-Part Challenge: Token Frequencies and Multiset Overlap with a Barebones RDD

    Using only flatMap, groupByKey, union, and collect on a minimal RDD class, implement word counting and a duplicate-preserving intersection of two datasets.

    Data Structure Designrddword-countmultiset-intersection
  • Dynamic ProgrammingMediumModel answer
    Maximum Valid-Partition Block Count for Every Prefix

    For each prefix of a string, find the maximum number of contiguous blocks it can be split into where every character in a block shares the same frequency.

    Dynamic Programmingdynamic programmingstringsfrequency countingprefix processing
  • Greedy & IntervalsHardModel answer
    Equalize Array Range with Bounded Transfers

    Find the minimum operations to narrow an array's range below a threshold by transferring bounded amounts between pairs of elements.

    Greedy & Intervalsgreedybinary-searchmathoptimization
  • Data Structure DesignMediumModel answer
    Build an Edit History System with Batching

    Implement a command history mechanism supporting single edits, grouped operations, and bidirectional traversal through past states.

    Data Structure Designundo-redocommand-patternstate-management
  • Data Structure DesignMediumModel answer
    Build a Scoped Owner and a Resizable Container from Scratch

    Implement a move-only smart pointer and a generic dynamic array in C++, exercising RAII, the Rule of Five, placement new, and exception-safe resizing.

    Data Structure Designc++memory-managementraiimove-semantics
  • Data Structure DesignHardModel answer
    Building a Live Text Editor: Buffer, History, and Suggestions

    Design and implement a text editor with insert/delete operations, undo/redo history, prefix-based autocomplete with frequency ranking, and multi-user concurrent editing.

    Data Structure Designdata-structuresundo-redotrieoperational-transformation
  • Trees & GraphsMediumModel answer
    Assemble a Binary Tree from Parent-Child Edge Records

    Given a list of directed labeled edges, reconstruct the binary tree they describe and return its root node.

    Trees & Graphsbinary-treehash-maptree-construction
  • StringsMediumModel answer
    Java String Interning, Identity, and Concatenation Costs

    Trace identity vs equality across literals, `new String`, `intern`, and constant folding, then compare loop `+`, `StringBuilder`, and `StringBuffer`.

    Stringsjavastring-poolimmutabilitystringbuilder
  • Heaps, Sorting & SearchHardModel answer
    Binary Search with Delayed Feedback Protocol

    Find a hidden number using binary search when each query returns the result of your previous guess instead of your current one.

    Heaps, Sorting & Searchbinary-searchalgorithmsfeedback-systems
  • Data Structure DesignMediumModel answer
    Extend a Python Abstract Pipeline with a Concrete File Processor

    Implement a concrete subclass inside a pre-built abstract framework that streams CSV input, transforms rows to JSON, and self-registers with a CLI factory.

    Data Structure Designobject-oriented-designabstract-base-classfile-iostreaming
  • Arrays & HashingMediumModel answer
    Sliding Tile Board: Merge Logic for All Four Directions

    Implement the slide-and-merge move for a 2048-style grid in all four directions, sharing a single merge routine across every direction.

    Arrays & Hashingarrayssimulationmatrix
  • StringsMediumModel answer
    Python Lists vs Tuples: Mutability, Memory, and Use Cases

    Compare Python lists and tuples across mutability, memory layout, hashability, and idiomatic use, including tricky edge cases.

    Stringspythondata-structuresmutabilityhashability
  • Data Structure DesignHardModel answer
    Ride-Share Wallet: Credit Vouchers, Zone Surcharges, and Refunds

    Simulate a ride-share payment ledger that drains expiring vouchers in priority order, applies zone-based surcharges to card charges, and splits refunds between card and new store credit.

    Data Structure Designsimulationpriority-queueinteger-mathstate-machine
  • Data Structure DesignMediumModel answer
    Event-Driven Email Notification System with Account Updates

    Build a scheduler that emits subscription notifications in time order, handling plan switches and subscription extensions with deterministic tie-breaking.

    Data Structure Designheapssimulationevent-drivenscheduling
  • Data Structure DesignMediumModel answer
    Design a Lazy Iterator Pipeline with Range and Combinators

    Build a pull-based iterator for ranges with configurable steps and endpoints, plus composable transformations like map, filter, zip, take, drop, and chain.

    Data Structure Designiteratorslazy-evaluationfunctional-programming
  • Data Structure DesignHardModel answer
    Build a Concurrent Multi-Constraint Rate Limiter

    Design a thread-safe class that enforces several independent rate limits simultaneously, with atomic all-or-nothing permit acquisition and rollback on failure.

    Data Structure Designconcurrencyrate-limitingsliding-windowatomicity
  • Data Structure DesignMediumModel answer
    Async URL Batch Fetcher with Concurrency Limits

    Build an async function that fetches a list of URLs with bounded parallelism, deduplicates identical URLs, preserves input order, and isolates per-URL errors.

    Data Structure Designasyncconcurrencypythondeduplication
  • Math & Bit ManipulationMediumModel answer
    Most Negative 8-bit Value with Exactly Three Set Bits

    Find the smallest two's-complement signed 8-bit integer whose binary representation contains exactly three 1 bits.

    Math & Bit Manipulationbit-manipulationtwo's-complementsigned-integers