KatInterview

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

Interview Practice Problems

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

6008
Problems
2226
Auto-graded
15
Topics
273
Added today

Showing 691–720 of 6008 results

  • Data Structure DesignMediumAuto-graded
    Conditional Form Visibility with Numeric Checks and Nested Groups

    Decide which questions of a form are visible by parsing typed answers and evaluating validated, nestable all/any conditions with numeric comparisons.

    Data Structure Designparsingvalidationrecursiondecimal
  • Math & Bit ManipulationMediumAuto-graded
    Collapse a Sequence to Ones Using Neighbor GCD Replacements

    Find the minimum number of neighbor-GCD replacements to turn an entire array into ones, using shortest coprime-window search and a lower-bound argument.

    Math & Bit Manipulationgcdsubarraynumber-theorycase-analysis
  • StringsMediumAuto-graded
    Earliest Longest Mirror Segment in a String

    Find the longest contiguous segment of a string that reads identically in both directions, preferring the leftmost one on ties and returning an empty string for empty input.

    Stringsstringspalindromeexpand-around-centertwo-pointers
  • Trees & GraphsMediumAuto-graded
    Minesweeper Tap: Flood-Reveal Safe Cells and Show Mine Counts

    Simulate one Minesweeper tap on a grid, flood-revealing connected zero-count cells with an iterative traversal and labelling border cells with their 8-neighbour mine counts.

    Trees & Graphsbfsflood-fillgridmatrix
  • Stacks & QueuesMediumAuto-graded
    Expand a Compressed Bracket Pattern String

    Tests stack-based parsing of nested repeat-count patterns, including multi-digit counts, nesting, and trailing letters, to rebuild the fully expanded string.

    Stacks & Queuesstackstringparsingnested-structures
  • Data Structure DesignMediumModel answer
    Repair a Faulty LRU Cache and Add Crash-Safe Persistence

    Find and fix the bugs in a broken fixed-capacity LRU cache, then make its acknowledged writes survive a crash using an append-only log, snapshots and atomic file replacement.

    Data Structure Designlru-cachedebuggingwrite-ahead-logcrash-recovery
  • System DesignMediumModel answer
    Design a Scalable Real-Time Event Notification Engine

    Design a robust event delivery platform supporting independent fan-out isolation, classified retry delays, rate limiting, and historical replays.

    System Designsystem-designpub-subevent-drivenrate-limiting
  • Heaps, Sorting & SearchMediumAuto-graded
    Rotated Array Lookup Plus Most Common Values

    Find a value's index in a rotated sorted array with binary search, then list the k most frequent values with ties broken by smaller value.

    Heaps, Sorting & Searchbinary-searchrotated-arrayhash-mapfrequency-count
  • Machine LearningHardModel answer
    How Bagging and Boosting Trade Off Bias Against Variance

    Explain how random forests and gradient boosting reshape the bias-variance decomposition, derive the variance of correlated averages, and say when each ensemble is the better choice.

    Machine Learningbias-variancerandom-forestgradient-boostingensembles
  • Dynamic ProgrammingMediumAuto-graded
    Shortest Nested Run-Length Encoding of a String

    Find the shortest nested repeat encoding of a string with interval DP over splits and repeats, using a fixed tie-break order so the output is unique.

    Dynamic Programmingdynamic-programmingstringsrecursionmemoization
  • System DesignMediumModel answer
    Design a Request-Response Based Instant Messaging Architecture

    Architect a 1-on-1 instant messaging backend relying exclusively on standard HTTP request-response APIs, managing message synchronization, ordering, idempotency, and push delivery at scale.

    System Designsystem-designmessagingdistributed-systemshttp-polling
  • System DesignHardModel answer
    Kafka Ordering, Durability, and Exactly-Once Processing

    Describe how Kafka's partitioned, replicated log and consumer groups shape ordering, scale, and resilience, and how to get effectively-once results from a pipeline.

    System Designkafkamessagingdelivery-semanticsreplication
  • Data Structure DesignMediumAuto-graded
    Phrase Completion Engine with Windowed Context Counts

    Simulate a command sequence on a context-based next-word model, using hash maps of counts and a lexicographic tie-break.

    Data Structure Designhash-mapn-gramsimulationstring-processing
  • Statistics & ExperimentsHardModel answer
    Measuring the Causal Impact of a New In-App Marketplace

    Plan an experiment to estimate how a new in-app shopping feature affects engagement and revenue, covering design, metrics, selection bias, interference, and the launch decision.

    Statistics & Experimentsab-testingcausal-inferencenetwork-effectsdiff-in-diff
  • Statistics & ExperimentsMediumModel answer
    Testing Opt-In Reward Ads in a Free-to-Play Mobile Game

    Design an A/B test for opt-in reward ads in a free-to-play game: choose metrics, set randomization and duration, and measure whether ads cannibalize in-app purchases.

    Statistics & Experimentsab-testingexperiment-designmetricscannibalization
  • Arrays & HashingMediumAuto-graded
    Contiguous Smallest-Value Blocks in a Shuffled Sequence

    Given a permutation of 1..N, decide for each k whether the values 1..k occupy a contiguous block of positions, using a running min/max position sweep.

    Arrays & Hashingpermutationarrayssweepmin-max
  • System DesignMediumModel answer
    Build a Real-Time Direct Messaging Backend for Millions of Users

    Design a horizontally scalable direct-messaging backend with live delivery, stored history, presence, per-conversation ordering and fault tolerance for 10 million daily users.

    System Designsystem-designwebsocketmessagingcassandra
  • Data Structure DesignMediumModel answer
    Thread-Safe Kitchen: Cook-Once, Pickup-Once Order Pipeline

    Build a thread-safe kitchen where producers place orders, chefs cook them, and customers block until their dish is ready, with no races, deadlocks, or busy-waiting.

    Data Structure Designconcurrencycondition-variableblocking-queuethread-safety
  • Math & Bit ManipulationMediumAuto-graded
    Binary Message Framing Processor

    Simulate encoding and decoding of a length-prefixed binary wire protocol with error validation.

    Math & Bit Manipulationbinaryparsingencodingbit-manipulation
  • StringsMediumAuto-graded
    Longest Run With No Repeated Character

    Find the length of the longest contiguous block of a string with no repeated character, using a linear-time sliding window with exact, case-sensitive comparison.

    Stringssliding-windowhash-maptwo-pointersstrings
  • Stacks & QueuesMediumAuto-graded
    Expand a Compact Pattern with Nested Multipliers

    Expand a string in which a positive integer followed by a bracketed block means that block repeats, with nesting; tests stack or recursive parsing and multi-digit number handling.

    Stacks & Queuesstackstring-parsingnested-structuresrecursion
  • Data Structure DesignMediumModel answer
    Time-Travel Key-Value Store with Point-in-Time Snapshots

    Design a hash-map-backed store that records every write with an increasing timestamp, answers reads as of any past moment, and exports a frozen plain-map snapshot.

    Data Structure Designhash-mapbinary-searchversioningsnapshot
  • Dynamic ProgrammingMediumAuto-graded
    Best Haul from a Row of Cash Stations

    Tests one-dimensional dynamic programming: pick values from a sequence so no two neighbors are both chosen, maximizing the total.

    Dynamic Programmingdynamic-programmingarraysoptimization
  • Trees & GraphsMediumAuto-graded
    Densest Graph Without Triangles: Count and Build

    Find the largest edge count of a triangle-free simple graph on n vertices and output a canonical extremal graph, testing Mantel's theorem and the complete bipartite construction.

    Trees & Graphsgraph-theoryconstructionbipartitemantel-theorem
  • StringsEasyAuto-graded
    Count Balanced Two-Block Binary Substrings

    Count substrings of a binary string made of one block of equal characters followed by a block of the other character, with both blocks the same length.

    Stringsstringstwo-pointersrun-lengthcounting
  • StringsMediumAuto-graded
    Longest Run Using No More Than Two Letter Kinds

    Find the longest contiguous stretch of a string containing at most two different characters, testing the sliding window technique with a frequency map.

    Stringssliding-windowhash-maptwo-pointersstrings
  • Stacks & QueuesMediumAuto-graded
    Unwrap Deeply Nested Lists Into One Sequence

    Collect every integer from a structure of arbitrarily deep nested lists in left-to-right order, without recursion, so extremely deep inputs do not overflow the call stack.

    Stacks & Queuesstackdfsiteratorsnested-lists
  • Trees & GraphsMediumAuto-graded
    Diff Two Versions of a Keyed Hierarchy

    Compare two keyed N-ary trees given as nested dicts and count nodes that were added, removed, given a new value, or attached to a different parent.

    Trees & Graphstreehash-mapdfstree-diff
  • System DesignMediumModel answer
    Circular Waits and Lock Contention: Spotting and Preventing Deadlocks

    Explain what a deadlock is, the conditions that make one possible, realistic scenarios, and the engineering techniques used to prevent, avoid, detect and recover from them.

    System Designconcurrencydeadlocklockingoperating-systems
  • BehavioralMediumModel answer
    Motivation, Setbacks, and Leading a Team Through Delivery Pressure

    A two-part behavioral practice problem on explaining why you want a specific role, responding to a rejection, and describing how you would manage delivery, upward pressure, and extra effort.

    Behavioralbehavioralleadershipmotivationconflict-resolution