KatInterview

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

Interview Practice Problems

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

5985
Problems
2218
Auto-graded
15
Topics
271
Added today

Showing 301–330 of 5985 results

  • Trees & GraphsMediumAuto-graded
    Counting Separate Land Patches in a 0/1 Grid

    Count connected components of 1-cells in a binary grid using only up/down/left/right adjacency, via flood fill or union-find.

    Trees & Graphsgraphbfsconnected-componentsmatrix
  • Arrays & HashingMediumAuto-graded
    Repeat Visitors Across UTC Days in an Event Feed

    Normalize ISO 8601 timestamps to UTC dates and use hashing to find users active on at least two distinct UTC calendar days.

    Arrays & Hashinghashingdatetimetimezonelogs
  • Math & Bit ManipulationMediumAuto-graded
    Cover an IPv4 Address Run with the Fewest Prefix Blocks

    Split a run of consecutive IPv4 addresses into the fewest aligned power-of-two prefix blocks using 32-bit integer and lowest-set-bit reasoning.

    Math & Bit Manipulationbit-manipulationgreedyipv4cidr
  • Data Structure DesignEasyModel answer
    Fleet Command Console for Grid-Walking Robots

    Design a text-driven controller that manages several robots on an unbounded grid, handling turns, steps, selection, error cases and cell collisions.

    Data Structure Designsimulationhash-mapcommand-parsingstate-machine
  • Arrays & HashingMediumAuto-graded
    Longest Daily Purchase Streak for Each Customer

    Group purchase records by customer, collapse same-day duplicates, and find the longest run of back-to-back calendar days, reporting results sorted by customer id.

    Arrays & Hashinghashingsortingdatesgaps-and-islands
  • System DesignHardModel answer
    Design an EV Fast-Charging Network Backend: Metering, Telemetry, Locator

    Design a backend for a fleet of EV fast-charging stalls covering energy-based billing, long-term health telemetry, and a nearby-available-charger search with prices.

    System Designsystem-designiotbillingtelemetry
  • Trees & GraphsMediumAuto-graded
    Smallest-Label Build Sequence with Cycle Check

    Produce the lexicographically smallest valid ordering of a dependency graph using a min-heap variant of Kahn's algorithm, returning an empty list if a cycle makes ordering impossible.

    Trees & Graphstopological-sortheapgraphcycle-detection
  • BehavioralMediumModel answer
    Structuring a Story About Technical Project Leadership

    A framework for detailing a technical project you led, covering technical trade-offs, goal setting, scope management, and leadership lessons.

    Behavioralbehavioralleadershipproject managementtechnical judgment
  • Greedy & IntervalsMediumAuto-graded
    Smallest-ID Room Allocation for Booking Time Slots

    Partition half-open time intervals across the fewest resources, deterministically giving each booking the lowest-numbered free resource, using sorting and two heaps.

    Greedy & Intervalsintervalsheapgreedysorting
  • Data Structure DesignMediumAuto-graded
    Simulate an Expiring Key-Value Store with Read-Through Loads

    Simulate a time-aware key-value store with expiry, stale entries that stay stored, and a read-through fetch whose loader outcome is given as data, with strict input validation.

    Data Structure Designsimulationhash-mapcachevalidation
  • Machine LearningHardModel answer
    Rapid-Fire ML Fundamentals Check for a Product Recommender

    Answer a set of short core machine-learning questions covering models, regularization, evaluation, optimization and ranking, framed around building a product recommendation system.

    Machine Learningmachine-learningfundamentalsregularizationevaluation
  • Statistics & ExperimentsMediumModel answer
    Chance That Two Random Lamp Schedules Overlap

    Two independent events start at uniformly random times in a 30-day window and last 9 and 12 days. Find the probability that their active periods share at least one moment.

    Statistics & Experimentsgeometric-probabilityuniform-distributioninterval-overlapcontinuous-probability
  • Data Structure DesignMediumAuto-graded
    Canvas Replay with Undo and Redo History

    Simulate a pixel canvas with draw, erase, flood fill, undo and redo, returning a canvas snapshot after every command while keeping the history stacks consistent.

    Data Structure Designstacksimulationflood-fillundo-redo
  • Trees & GraphsMediumAuto-graded
    Collect Path-Tagged Errors from a Nested Payload Schema Check

    Recursively walk a JSON-like value alongside a simplified schema and report type and missing-key errors with exact paths, in deterministic order.

    Trees & Graphsrecursiondfsjsonvalidation
  • Dynamic ProgrammingHardModel answer
    Maximize Allocation Across Server Pools with Migration Limits

    Aggregate daily resource usages and calculate optimal allocations under unrestricted and migration-bounded pool selection constraints using dynamic programming.

    Dynamic Programmingarraysdynamic-programminggreedy-intervals
  • Data Structure DesignMediumModel answer
    Build a Weighted Hash Ring for Sharding Keys Across Servers

    Design a hash ring with weighted virtual nodes that assigns keys to servers, supports adding and removing servers with little key movement, and handles collisions and concurrency.

    Data Structure Designconsistent-hashingvirtual-nodesbinary-searchthread-safety
  • Machine LearningMediumModel answer
    Joint Image-Text Embeddings: Training, Losses, and Retrieval Pitfalls

    Explain how a dual-encoder image-text model is trained and used, compare contrastive losses, and discuss embedding retrieval weaknesses, alternatives, and popularity bias.

    Machine Learningmultimodalcontrastive-learningdense-retrievalpopularity-bias
  • Trees & GraphsMediumAuto-graded
    Count Node Changes Between Two Keyed Hierarchies

    Compare two keyed trees in parallel and count changed nodes, where a changed value replaces its whole subtree and unmatched nodes count with their subtrees.

    Trees & Graphstreedfshash-mapsubtree-size
  • Data Structure DesignMediumAuto-graded
    Point-in-Time Set Views from an Operation Log

    Simulate a set that processes add, remove, contains and snapshot operations, where each snapshot must be an independent frozen copy of the set at that moment.

    Data Structure Designdesignhash-setsnapshotsimulation
  • Data Structure DesignMediumAuto-graded
    Simulate a Fixed-Size Cache Under LRU or LFU Eviction

    Replay a list of get/put operations on a bounded cache that evicts by recency or by frequency (ties broken by recency), and return the result of each operation.

    Data Structure Designhash-mapordered-dictlrulfu
  • BehavioralMediumModel answer
    Shipping Under Pressure: Ethics, Risk, and Thankless Work

    Describe a time you faced an ethical risk, a serious process failure, or a task nobody wanted, and explain how you judged it, persuaded others, and changed team practice.

    Behavioralbehavioralethicsinfluence-without-authorityownership
  • Data Structure DesignMediumModel answer
    Function Composition Twice and Core Container Cost Comparison

    Write a helper that feeds a function's output back into itself, explain closures and side effects, then compare arrays, linked lists, stacks and queues by operation cost.

    Data Structure Designhigher-order-functionsclosuresside-effectscomplexity-analysis
  • Arrays & HashingMediumAuto-graded
    Distinct Value Foursomes Hitting a Target Total

    Find every distinct set of four values, taken from different positions, that add up to a target, with no repeated value combinations in the output.

    Arrays & Hashingtwo-pointerssortingdeduplicationk-sum
  • Arrays & HashingEasyAuto-graded
    Count Shoppers With Visits on Two or More Days

    Group log entries by person and ignore repeats on the same day, then count how many people appear on at least two different calendar days.

    Arrays & Hashinghash-sethash-mapgroupingdeduplication
  • Statistics & ExperimentsHardModel answer
    Decomposing Revenue Drops and Measuring Promotional Cannibalization

    Perform a path decomposition on business metrics to isolate mix effects, evaluate promotional unit economics, and design an experiment to test cannibalization.

    Statistics & ExperimentsA/B TestingExperiment DesignAttributionBusiness Analytics
  • System DesignMediumModel answer
    Cutting Read Latency in a Normalized Relational Schema

    Speed up the hottest reads of a live service backed by a normalized database, and explain the write-path cost, freshness impact and rollout plan of each change.

    System Designdatabase-designdenormalizationcachingread-latency
  • BehavioralMediumModel answer
    Greenlight a Plant-Based Burger? Build the Business Case

    Decide as the business owner whether to fund a plant-based burger now, backing the call with customer, NPV, operations, brand and staged-rollout reasoning.

    Behavioralproduct-strategynpvcannibalizationstaged-rollout
  • Machine LearningMediumModel answer
    Building Dependable Tool-Using LLM Agents End to End

    Explain how an LLM agent invokes tools, keeps calls well-formed, recovers from bad calls, and stops runaway tool loops, with concrete engineering trade-offs.

    Machine Learningllm-agentstool-callingstructured-decodingreliability
  • Statistics & ExperimentsMediumModel answer
    Revenue-Share Merchant Loans: Metrics, Risk, Offers, Profit Drop

    Analyze a platform's revenue-share working-capital loan for merchants: design a monitoring dashboard, flag risky borrowers, compare offer formats, and diagnose a two-quarter profit decline.

    Statistics & Experimentsproduct-analyticscredit-riskexperimentationmetrics-design
  • Stacks & QueuesMediumAuto-graded
    Collapse Adjacent Edits Before Applying Them to a Text Buffer

    Simulate a queue of insert and format edits, merging adjacent inserts and dropping repeated adjacent formats, then return the final text and ordered list of applied styles.

    Stacks & Queuesstacksimulationcommand-patternstrings