KatInterview

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

Interview Practice Problems

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

6025
Problems
2231
Auto-graded
15
Topics
273
Added today

Showing 1261–1290 of 2231 results

  • Arrays & HashingHardAuto-graded
    Maximize Total Distinct Values Across Two Arrays

    Tests greedy reasoning, frequency counting, and backtracking search to maximize the combined distinct-value count across two arrays given a limited swap budget.

    Arrays & Hashingbacktrackinggreedyfrequency-counting
  • Linked ListsMediumAuto-graded
    Walking Both Ways to Measure a Doubly Linked Chain

    Given neighbor links for a group of disjoint chains, count how many nodes sit in the chain containing a given start node.

    Linked Listslinked-listtraversaltwo-pointerssimulation
  • StringsMediumAuto-graded
    Count Character Mismatches Across All Palindrome Mirrors

    Tests the ability to reframe a quadratic substring enumeration into a pair-centric counting problem with geometric weight calculations.

    Stringscombinatoricsstring-algorithmsoptimization
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Expected Value from Sequential Uniform Draws

    Tests understanding of optimal stopping via backward induction and dynamic threshold computation.

    Dynamic Programmingoptimal-stoppingbackward-inductionexpected-value
  • Trees & GraphsMediumAuto-graded
    Retrieve Kth Smallest Element from Array-Encoded BST

    Tests in-order traversal of a binary search tree encoded in parallel arrays, with early termination and iterative stack management.

    Trees & Graphsbinary-search-treein-order-traversaliterativestack
  • Math & Bit ManipulationMediumAuto-graded
    Minimize Expected Candidates with Position-Match Feedback

    Tests ability to model a greedy partitioning strategy using bitmask bucketing to minimize expected remaining candidates under green-only feedback.

    Math & Bit Manipulationgreedybitmaskhashing
  • Trees & GraphsMediumAuto-graded
    Count Reachable Cell Clusters in a Grid

    Tests grid-based connected-components detection using flood-fill or DFS, covering neighbor connectivity, visited-state tracking, and iterative traversal.

    Trees & Graphsgraphsgriddfsconnected-components
  • SQL & DataHardAuto-graded
    Compute Per-Warehouse Reorder Alerts from Inventory Logs

    Tests group-by aggregation over a list-of-dict records, computing per-warehouse stock summaries and flagging items that need reordering.

    SQL & Datadata processinggroup-by aggregationdictionaries
  • Data Structure DesignMediumAuto-graded
    Train Line Fare System with Dynamic Routes and Weekend Pricing

    Tests object-oriented design, index lookups, dynamic data structure updates, and conditional pricing rules in a fare calculation system.

    Data Structure Designobject-oriented-designhash-mapsimulation
  • Arrays & HashingEasyAuto-graded
    Daily and Rolling Active User Counts with Zero-Fill

    Tests building a complete calendar spine, counting distinct daily users, and maintaining a 30-day rolling active-user window.

    Arrays & Hashinghash-mapsliding-windowdate-manipulation
  • Data Structure DesignMediumAuto-graded
    Tiered Cache with TTL and Priority Fallback

    Implement a hierarchical key-value cache with expiration times, priority-based lookups, and lazy eviction across multiple storage tiers.

    Data Structure Designhash-tableheapdata-structure-design
  • Arrays & HashingHardAuto-graded
    Three-in-a-Row: Find the Winner on a 3×3 Grid

    Tests whether you can encode all win conditions for a 3×3 grid as data and apply a uniform check to identify a winning player.

    Arrays & Hashingarraysgame-theorysimulation
  • Trees & GraphsMediumAuto-graded
    Fold and Prune an Arithmetic Expression Tree

    Tests recursive AST traversal by simplifying an arithmetic expression tree through constant folding and algebraic identity rules, including cascading rewrites.

    Trees & Graphstreesrecursionast
  • SQL & DataMediumAuto-graded
    Per-Account Usage Means Above a Threshold

    Group readings by account id, keep accounts whose unrounded mean CPU, memory, or disk usage tops 50, then emit half-up rounded, email-sorted records.

    SQL & Dataaggregationgroupinghashingsorting
  • Greedy & IntervalsMediumAuto-graded
    Peak Activity Count from Time Intervals

    Tests sweep-line techniques for interval overlap detection, event aggregation at boundaries, and proper handling of half-open interval semantics.

    Greedy & Intervalsintervalssweep-linesortingevent-processing
  • Arrays & HashingEasyAuto-graded
    Closest Pair of Target Words

    Find the minimum index gap between any occurrence of two distinct words in a list using single-pass tracking.

    Arrays & Hashingarraystringsingle-passtwo-pointer
  • Math & Bit ManipulationMediumAuto-graded
    32-Bit Integer Product via Shift-and-Add

    Tests mastery of bitwise arithmetic, sign handling, two's-complement overflow semantics, and O(log n) shift-and-add multiplication without using * or /.

    Math & Bit Manipulationbit-manipulationmathoverflowtwo's-complement
  • StringsEasyAuto-graded
    Convert Integer to English Words

    Tests ability to decompose integers into groups and translate numeric values into properly formatted English text with correct scaling terms.

    Stringsrecursionmathstring-formatting
  • Arrays & HashingMediumAuto-graded
    Find User Pairs with Enough Overlapping Interests

    Tests your ability to invert a membership index and use co-occurrence counting to efficiently find all pairs sharing at least k common items.

    Arrays & Hashinghash-mapsetsco-occurrenceinverted-index
  • Arrays & HashingMediumAuto-graded
    Trim a Record List to a Token Budget with a Sliding Window

    Tests the sliding-window technique: conditionally compact a list of records to the longest contiguous run whose token sum fits a given budget.

    Arrays & Hashingsliding-windowarraystwo-pointers
  • Stacks & QueuesHardAuto-graded
    Reconstruct Function Lifetimes from Periodic Stack Snapshots

    Tests ability to diff consecutive call-stack snapshots using longest-common-prefix analysis and stack unwinding to produce ordered START/END lifecycle events.

    Stacks & Queuesstacksimulationtwo-pointers
  • StringsMediumAuto-graded
    Words Buildable from Two Different Entries in a Set

    Use a hash set to test every split point of each word, reporting words formable as two distinct list entries, sorted.

    Stringshash-setstringssortingenumeration
  • Data Structure DesignHardAuto-graded
    Policy-Driven Spending Report Checker

    Tests whether a candidate can implement a multi-scope rule evaluation pipeline that collects all violations across item-level, aggregate, and relational policy checks.

    Data Structure Designobject-oriented designopen-closed principledata aggregation
  • Arrays & HashingMediumAuto-graded
    Track Items Surviving Sequential Shifts on a Grid

    Determine which grid cells remain in bounds after a sequence of directional shifts, testing displacement tracking and boundary analysis.

    Arrays & Hashingsimulation2d-arrayprefix-summath
  • Arrays & HashingMediumAuto-graded
    Momentum-Weighted Portfolio: Daily Log Return Statistics

    Tests simulation of a daily rebalancing strategy where portfolio weights are proportional to positive asset returns, requiring correct timeline logic and statistical output.

    Arrays & Hashingsimulationfinancestatistics
  • Arrays & HashingMediumAuto-graded
    Overlapping 2D Block Move with O(1) Extra Memory

    Tests whether a candidate can copy a rectangular subregion of a 2D grid onto another position in the same grid, in place, without corrupting overlapping data.

    Arrays & Hashingarraysin-placetwo-dimensional
  • Dynamic ProgrammingHardAuto-graded
    Cheapest Round-Trip Inspection Tour

    Tests bitmask dynamic programming (Held–Karp) to find the minimum-cost Hamiltonian cycle in a small directed weighted graph.

    Dynamic Programmingbitmask-dptraveling-salesmangraphs
  • Arrays & HashingMediumAuto-graded
    Shortest Window With Unique-Value Sum Meeting a Goal

    Sliding-window task where the window score is the sum of its distinct values, not the plain sum of its elements.

    Arrays & Hashingsliding-windowhash-maptwo-pointersarrays
  • Dynamic ProgrammingMediumAuto-graded
    Count Paths of Fixed Length in a DAG

    Tests dynamic programming on graphs, topological ordering, and systematic state-space enumeration with path-length constraints.

    Dynamic Programminggraphstopological-sortdag2d-dp
  • Trees & GraphsHardAuto-graded
    Diff Two Versions of a Configuration Tree

    Tests recursive-free N-ary tree traversal and set-based diffing to count nodes added, removed, or modified between two tree snapshots.

    Trees & Graphstreeshashingtraversal