KatInterview

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

Interview Practice Problems

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

6070
Problems
2251
Auto-graded
15
Topics
273
Added today

Showing 1741–1770 of 6070 results

  • Statistics & ExperimentsMediumModel answer
    Building a Cost-Aware Objective for a One-Period Stat-Arb Portfolio

    Augment a mean-variance stat-arb objective with realistic trading and holding costs, make units consistent, avoid double counting, calibrate from data, and check convexity.

    Statistics & Experimentsportfolio-optimizationtransaction-costsmarket-impactconvex-optimization
  • Trees & GraphsMediumAuto-graded
    Tree Span and Grid Escape: Two Graph Queries in One Call

    Compute a tree's longest path in edges and the shortest 4-directional route through a grid with obstacles, returning both results together.

    Trees & Graphsbfstree-diametershortest-pathgrid
  • Data Structure DesignMediumAuto-graded
    Chat Activity Tracker with a Rolling 15-Minute Window

    Simulate a chat activity tracker with a closed rolling window, touch/close liveness rules, and out-of-order events, using bounded-memory eviction.

    Data Structure Designdesignhash-mapheapsliding-window
  • Stacks & QueuesEasyAuto-graded
    Collapse Repeated Letters: Pair Cancel or Full Run Wipe

    Simulate cascading deletions of equal neighbouring letters with a stack, either cancelling pairs or erasing whole leftmost runs, and return what is left.

    Stacks & Queuesstackstringsimulationrun-length
  • Arrays & HashingMediumAuto-graded
    Count Index Pairs With a Fixed Value Gap

    Count index pairs i < j whose values differ by exactly k, using a frequency map and handling the k = 0 case separately to avoid double counting.

    Arrays & Hashinghash-mapcountingfrequencypairs
  • Statistics & ExperimentsMediumModel answer
    Evaluating an In-App Store Ad Ranking Shift

    Design an experimentation and evaluation framework to test upranking native checkout ads over external link ads, handling marketplace interference and heterogenous segment impacts.

    Statistics & ExperimentsA/B TestingExperiment DesignMarketplace InterferenceHeterogeneous Effects
  • Heaps, Sorting & SearchMediumAuto-graded
    Budget Growth Through Threshold-Locked Ventures

    Greedy plus min-sorted unlocking and a max-heap: pick up to k ventures, each requiring a minimum budget, to maximize the final budget.

    Heaps, Sorting & Searchgreedyheapsortingpriority-queue
  • Trees & GraphsMediumAuto-graded
    Count Islands of Mutual Acquaintances in a Matrix

    Count connected components in an undirected graph given as a symmetric adjacency matrix, without modifying the input, using graph traversal or union-find.

    Trees & Graphsgraphconnected-componentsdfsunion-find
  • Data Structure DesignMediumModel answer
    Random Equipment Lending Pool with Constant-Time Operations

    Build an in-memory pool that lends out a uniformly random free item to a borrower, accepts returns, and allows retirement of idle items, with every operation in O(1) average time.

    Data Structure Designhash-maprandomizedswap-and-popinsert-delete-getrandom
  • StringsMediumAuto-graded
    Longest Stretch of Non-Repeating Characters

    Find the length of the longest contiguous run in a string where every character is distinct, using a linear-time sliding window with index tracking.

    Stringssliding-windowhash-maptwo-pointersstrings
  • Heaps, Sorting & SearchMediumModel answer
    Random Index Selection by Given Weights

    Design an index sampler where each element's probability of being chosen is proportional to its assigned weight.

    Heaps, Sorting & Searchprefix-sumbinary-searchrandomizationdata-structure-design
  • Math & Bit ManipulationEasyModel answer
    Two Islanders, One Accusation: Which Role Pairs Work?

    One islander accuses the other of always lying. Test all four role pairings and decide which ones are logically possible.

    Math & Bit Manipulationlogicpuzzlecase-analysisknights-and-knaves
  • Heaps, Sorting & SearchMediumAuto-graded
    Locate the Span of a Value in a Sorted List

    Use binary search to find the first and last positions of a value in a sorted list with duplicates, in logarithmic time, returning [-1, -1] if it is absent.

    Heaps, Sorting & Searchbinary-searcharraysbisectsorted-array
  • Arrays & HashingMediumAuto-graded
    Collapse Rapid Cart Adds into Daily Pacific Action Counts

    Filter add-to-cart events, convert UTC to Pacific dates, merge rapid repeats into single actions with a chained gap rule, and count the actions per user, date and SKU.

    Arrays & Hashinghashinggroupingdatetimetimezones
  • Arrays & HashingMediumModel answer
    Best Single Trade Within a Limited Holding Period

    Find the most profitable buy-then-sell pair in a price array when the sale must happen within D days of the purchase, in O(n) time and O(1) extra space.

    Arrays & Hashingsliding-windowblock-decompositionmonotonic-dequestock-trading
  • Trees & GraphsMediumModel answer
    Repairing a Search Tree After One Pair of Keys Trades Places

    Two keys in a binary search tree were exchanged by mistake. Restore ordering by swapping values back, keeping the shape intact, in linear time and constant extra space.

    Trees & Graphsbinary-search-treemorris-traversalin-ordertree-recovery
  • BehavioralMediumModel answer
    Balancing Product, Design, and Engineering Demands on a Deadline

    A behavioral prompt on resolving clashing goals across product, design, and engineering, making a costly trade-off under time pressure, and describing your working style and personal motivations.

    Behavioralbehavioralcross-functionaltrade-offsstar-method
  • Data Structure DesignMediumAuto-graded
    Design a Dispatch Queue for Autonomous Taxi Requests

    Simulate an event-driven dispatching system that maintains pending requests ordered by pickup time and processes state updates efficiently using heaps and hash maps.

    Data Structure Designheaphash-tabledesignsorting
  • Greedy & IntervalsMediumAuto-graded
    Combine Overlapping Ranges and Count Unique Land Shapes

    Merge overlapping or touching closed ranges, and count land regions in a binary grid that differ in shape when only shifting is allowed.

    Greedy & Intervalsintervalssortingdfsgrid
  • Machine LearningHardModel answer
    Optimize Perishable Food Stocking Under Asymmetrical Failure Costs

    Design an end-to-end ML and inventory system to predict demand distributions and output cost-optimal daily stocking levels under asymmetric waste and stockout penalties.

    Machine Learningmachine-learningdemand-forecastingprobabilistic-modelingnewsvendor-problem
  • Arrays & HashingEasyAuto-graded
    Find the Maximum Value in a Large Numerical Stream

    Find the maximum integer in a sequence while accounting for empty inputs and signed values.

    Arrays & Hashingarraysstreamingbasics
  • BehavioralHardModel answer
    Behavioral Loop: Disagreement, Failure, and Project Ownership

    Tell three structured stories: a substantive disagreement you resolved, a serious mistake you owned and fixed systemically, and a project you led, defended in technical depth.

    Behavioralbehavioralleadershipconflict-resolutionpostmortem
  • BehavioralMediumModel answer
    Articulating Scope, Impact, and Leadership Under Line-Item Challenges

    Learn how to present technical ownership, trade-offs, and career advancement under intense line-item questioning without losing composure or structure.

    BehavioralBehavioralLeadershipTechnical CommunicationPromotion
  • System DesignMediumModel answer
    Build a Timed and Recurring Task Execution Platform

    Design a service that accepts tasks, fires them immediately, at a future time or on a cron schedule, runs them on a worker fleet, and tracks each execution reliably.

    System Designsystem-designschedulerdistributed-systemscron
  • Math & Bit ManipulationEasyAuto-graded
    Is This Dice Wager Worth Playing? Expected Value Check

    Count outcomes of a two-dice contest where ties favor the house, compute the expected profit per round, and decide whether a risk-neutral player should take the bet.

    Math & Bit Manipulationprobabilityexpected-valuemathcounting
  • Arrays & HashingEasyAuto-graded
    Identify Redundant Files by Content Matching

    Cluster files that share identical byte contents by filtering first on file size metadata and then hashing content.

    Arrays & Hashingarrayshash mapstrings
  • System DesignHardModel answer
    Design an Enterprise Knowledge Base RAG Platform

    Architect an end-to-end Retrieval-Augmented Generation system handling millions of internal documents, low latency, real-time updates, and strict document-level security.

    System Designragvector-searchsystem-designmachine-learning
  • BehavioralMediumModel answer
    Mastering Behavioral and Leadership Scenarios in Engineering Interviews

    A comprehensive guide to structured response frameworks for technical behavioral interviews, focusing on ownership, collaboration, prioritization, and technical trade-offs.

    Behavioralleadershipbehavioralprioritizationconflict-resolution
  • Linked ListsMediumAuto-graded
    Duplicate Linked List with Arbitrary Pointers

    Demonstrate deep copying of a sequential structural chain featuring auxiliary target links via node-level or serialized array transformations.

    Linked Listslinked-listsarraysdeep-copy
  • Data Structure DesignHardAuto-graded
    Leftmost-Fit Block Reservation with Owner Release

    Simulate a storage pool that reserves the leftmost run of contiguous free cells per request and releases everything an owner holds, using efficient free-run tracking.

    Data Structure Designsegment-treesimulationinterval-merginghash-map