KatInterview

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

Coding Interview Problems

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

5971
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 571–600 of 650 results

  • Data Structure DesignMediumModel answer
    Data Structure Selection: Complexity and Trade-offs

    Analyze time and space complexity for standard data structures and explain when to use each based on access patterns and constraints.

    Data Structure Designdata-structurescomplexity-analysistrade-offs
  • Data Structure DesignMediumModel answer
    Complete Concrete Classes in an Abstract Base Hierarchy

    Implement missing methods in concrete subclasses that inherit from abstract base classes while maintaining type safety and LSP compliance.

    Data Structure Designobject-oriented-designinheritanceabstractiondesign-patterns
  • Dynamic ProgrammingHardModel answer
    Balance Mixed Bracket Types with Minimum Deletions

    Delete the fewest bracket characters to make all remaining brackets properly matched and nested, keeping all non-bracket characters intact.

    Dynamic Programmingdynamic-programmingstringsinterval-dp
  • Data Structure DesignMediumModel answer
    Build a Flexible Tennis Game Score Tracker

    Create a scoring system for a single tennis game that records points, displays readable scores, detects game completion, and supports multiple rule variants.

    Data Structure Designobject-oriented-designstrategy-patternstate-management
  • Data Structure DesignMediumModel answer
    Lottery Bucket with Constant-Time Operations and Duplicates

    Build a data structure supporting O(1) add, remove, and uniform random selection where duplicate entries are treated as separate items.

    Data Structure Designhash-tablearrayrandomizationduplicates
  • Data Structure DesignMediumModel answer
    Hierarchical Task Tracker: OO Domain Model & Service Layer

    Design and implement an object-oriented model for a nested task manager with status propagation, recursive deletion, and attribute-based filtering.

    Data Structure Designobject-oriented designtree traversalAPI designcomposite pattern
  • Data Structure DesignMediumModel answer
    Dense-Index Data Structure Code Review

    Review a structure storing items under contiguous integer keys with O(1) random selection and removal while preserving index density.

    Data Structure Designcode-reviewdata-structuresrandomizationcomplexity-analysis
  • Data Structure DesignMediumModel answer
    Greedy Card Selection with Dynamic Deck State

    Simulate a threshold-based card selection strategy that accounts for a shrinking deck, tracking which cards remain available after each decision.

    Data Structure Designfenwick-treegreedysimulationbinary-indexed-tree
  • Data Structure DesignMediumModel answer
    Area-Weighted Random Point Sampling Across Multiple Squares

    Design a class for uniform random point sampling inside a square, then extend it to sample uniformly from the union of N non-overlapping squares.

    Data Structure Designprobabilityprefix-sumssamplinggeometry
  • Data Structure DesignHardModel answer
    Build an Idempotent Financial Account System

    Create an in-memory account manager that enforces balance rules, prevents duplicate processing via transaction IDs, and detects conflicting retries.

    Data Structure Designfinancial-systemsidempotencydata-structuresstate-management
  • Trees & GraphsMediumModel answer
    Weighted Grid Navigation: Minimum Cost Path Around Walls

    Find the cheapest path through a cost-weighted grid containing impassable walls, returning the total cost and route, or -1 if no path exists.

    Trees & Graphsdijkstrapriority-queueshortest-pathgrid
  • Data Structure DesignHardModel answer
    Design a Thread-Safe Resource Pool with RAII Handles

    Build a concurrent object pool in C++ that safely manages reusable resources with blocking acquisition, automatic return via RAII, and graceful shutdown.

    Data Structure Designconcurrencyc++raiithread-safety
  • Data Structure DesignMediumModel answer
    Call Channel State Manager

    Build a stateful manager that allows exactly one active two-party call at a time, with proper validation and error handling.

    Data Structure Designstate-machineobject-oriented-designvalidationexceptions
  • Data Structure DesignMediumModel answer
    Build a Fee Calculator with Comprehensive Test Coverage

    Write a service class that computes fees based on business rules, then extend it and write unit tests covering normal cases, boundaries, and errors.

    Data Structure Designtestingvalidationobject-oriented-design
  • Data Structure DesignHardModel answer
    Build a Function Pipeline and JSON Serialization Mixin

    Create a left-to-right function compositor and a mixin class that serializes object attributes to JSON with configurable privacy filtering.

    Data Structure Designpythonclosuresmetaprogrammingserialization
  • Trees & GraphsMediumModel answer
    Timestamp When All Users Form a Single Connected Group

    Given users and a chronological log of pairwise interactions, determine when everyone first becomes transitively connected through interaction chains.

    Trees & Graphsunion-findgraph-connectivitytemporal-graphdisjoint-set
  • Data Structure DesignEasyModel answer
    Build an Inventory Manager with Nested Recipe Expansion

    Implement a service that models recipes with nested dependencies, validates acyclic graphs, and atomically decrements raw inventory when orders succeed.

    Data Structure Designobject-oriented-designgraph-validationatomicityconcurrency
  • StringsMediumModel answer
    Plain-Text to HTML: Paragraphs, Blockquotes, and Strikethrough

    Write a function that converts a plain-text string to HTML with paragraphs, soft line breaks, blockquotes, and strikethrough, handling all edge cases correctly.

    Stringsparsingstring-processingtwo-pass
  • Data Structure DesignMediumModel answer
    Build a Social Payment Platform with Friend Connections

    Implement an in-memory system that handles user registration, friendship management, and peer-to-peer money transfers with proper validation.

    Data Structure Designobject-oriented-designhash-tablesstate-management
  • Stacks & QueuesMediumModel answer
    Parse and Compute Arithmetic Expression with Recursion

    Write a parser that evaluates arithmetic expressions with integers, four operators, parentheses, and unary negation using recursive descent or explicit stack DFS.

    Stacks & Queuesrecursionparsingoperatorsdfs
  • Data Structure DesignMediumModel answer
    Build a Tic-Tac-Toe Game Engine with Move Validation

    Design and implement a class that tracks board state, validates moves, detects winners, and enforces turn-based gameplay for a 3×3 grid game.

    Data Structure Designstate-machinegame-logicobject-oriented-design
  • Arrays & HashingHardModel answer
    Rearrange Grid Cells into Alternating-Row Order via Adjacent Swaps

    Output a sequence of orthogonal-neighbor swaps that transforms a permuted square grid into alternating-row sorted form.

    Arrays & Hashingmatrixgreedysimulationsorting
  • Trees & GraphsMediumModel answer
    Recursive Disk Transfer Between Three Pegs

    Move n disks from one peg to another using a spare peg, one at a time, never placing a larger disk on a smaller one.

    Trees & Graphsrecursionalgorithm-designcomplexity-analysis
  • Data Structure DesignMediumModel answer
    Scored Catalog Rotator: Ordered Traversal with Live Updates

    Design an in-memory playlist that always serves the highest-scored unseen item per round, supports live score changes, and is safe for concurrent callers.

    Data Structure Designheaptreemapconcurrencydata-structure-design
  • Arrays & HashingMediumModel answer
    Three Algorithm Challenges: Enumeration, Backtracking, and Merging

    Solve three distinct problems: compute the k-th element in a lexicographically ordered sequence, count valid paths under geometric constraints, and merge overlapping ranges.

    Arrays & Hashingcombinatoricsbacktrackingtwo-pointersenumeration
  • Arrays & HashingMediumModel answer
    Parallel Image Pipeline Without External Libraries

    Build a CPU-based image transformation engine that chains grayscale, brightness, and resize operations across multiple images using pure Python.

    Arrays & Hashingimage-processingparallel-processingarray-manipulation
  • Math & Bit ManipulationMediumModel answer
    Classifying Circle Pair Relationships

    Determine whether two circles intersect at two points, are tangent at one point, or have no boundary contact.

    Math & Bit Manipulationgeometrydistanceedge-casesnumerical-stability
  • Data Structure DesignMediumModel answer
    Restaurant Query and Order Analytics System

    Design data structures and algorithms to query restaurants by price and distance, then compute order statistics and rankings over time windows.

    Data Structure Designdata-structuresalgorithmstime-seriesheap
  • Data Structure DesignMediumModel answer
    Build an In-Memory Meal Catalog with Search and Updates

    Create a service that stores meal records with auto-incrementing IDs, normalized fields, atomic modifications, and filtered search with multiple sort orders.

    Data Structure Designdata-structuresstate-managementindexingnormalization
  • Data Structure DesignMediumModel answer
    Credit System with Expiration and Time-Ordered Replay

    Build a credit tracking system where allocations expire, spending prioritizes earliest expiration, and operations arrive out of chronological order.

    Data Structure Designheaptime-orderingdata-structure-design