KatInterview

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

Interview Practice Problems

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

6021
Problems
2229
Auto-graded
15
Topics
272
Added today

Showing 901–930 of 2229 results

  • Data Structure DesignMediumAuto-graded
    Simulate 2048 Moves with Scripted Tile Spawns

    Simulate a 4x4 sliding-tile merge game with scripted spawns, skipping spawns on no-op moves, then report the final board and whether any move remains.

    Data Structure Designsimulationmatrixstate-managementdeterministic-testing
  • Dynamic ProgrammingMediumAuto-graded
    Highest-Yield Consecutive Stretch in a Profit Log

    Find the largest total achievable by a non-empty run of adjacent integers, handling all-negative inputs and large sums, in one pass with constant extra space.

    Dynamic Programmingkadanesubarraydynamic-programmingarrays
  • Arrays & HashingEasyAuto-graded
    Bayesian Origin Probability for Sampled Items

    Calculate the posterior probability that two black items came from a specific facility using Bayes' Theorem.

    Arrays & Hashingstatisticsprobabilitybayes-theorem
  • Arrays & HashingEasyAuto-graded
    Overlap Ratio of Two Token Lists

    Compute the overlap ratio between the distinct strings of two lists using hash sets, with exact string matching and a defined result when both lists are empty.

    Arrays & Hashinghash-setsetsstringsedge-cases
  • Greedy & IntervalsEasyAuto-graded
    Find Peak Event Density in Fixed Duration Window

    Determine the maximum number of recorded logs occurring within a contiguous time interval using a sliding window approach.

    Greedy & Intervalssliding-windowtwo-pointersarraysintervals
  • Trees & GraphsMediumAuto-graded
    Hide Flagged Comment Threads for a Pet-Preference Reader

    Find all comments hidden from a reader when any flagged comment hides its whole reply subtree, handling unordered input, dangling parent IDs, and very deep chains.

    Trees & Graphstreedfshash-mapforest
  • Math & Bit ManipulationEasyAuto-graded
    Determine Convergence of Digit-Square Sums

    Simulate a transformation that replaces a number with the sum of its squared digits, determining if it terminates at 1 or loops indefinitely.

    Math & Bit Manipulationmathhash-tabletwo-pointers
  • StringsMediumAuto-graded
    Group Digits of a Signed Integer with a Custom Delimiter

    Build a string from a signed 64-bit integer, placing a delimiter between each group of three digits from the right, with the minus sign kept in front, using manual digit handling.

    Stringsstringsmathformattingdigit-extraction
  • Trees & GraphsMediumAuto-graded
    Alphabetical Job Scheduler with Prerequisite Rules

    Produce a full run order for jobs under prerequisite constraints, always picking the alphabetically smallest available job, or return an empty list if a cycle exists.

    Trees & Graphstopological-sortheapgraphkahn-algorithm
  • Heaps, Sorting & SearchMediumAuto-graded
    Locate K Nearest Values in a Sorted Sequence

    Binary search for the starting boundary of a contiguous k-element slice minimizing distance to a given target in a sorted list.

    Heaps, Sorting & Searchbinary-searchtwo-pointersarrays
  • Trees & GraphsMediumAuto-graded
    Vertical Column Grouping of Array-Represented Binary Trees

    Organize the elements of a binary tree into vertical columns using level-order traversal rules on a level-order array input.

    Trees & Graphstrees-graphsbreadth-first-searcharraysqueues
  • Data Structure DesignMediumAuto-graded
    Simulate a Tiny Hierarchical File Store from a Command Log

    Replay a command log against an in-memory directory tree, with auto-created parent folders, file appends, reads and sorted listings.

    Data Structure Designdesigntrietreehash-map
  • Arrays & HashingMediumAuto-graded
    Most Popular Three-Page Browsing Path Across Users

    Group visit logs by user, order them by time, and find the three-page ordered path shared by the most distinct users, with a lexicographic tie-break.

    Arrays & Hashinghashingsortingcombinationscounting
  • Trees & GraphsMediumAuto-graded
    Find k-th Subordinate in Cascade Traversal

    Find the k-th node reached during a preorder depth-first traversal of a specific node's subtree when children are visited in ascending numerical order.

    Trees & Graphstrees-graphsdfstree-traversal
  • Data Structure DesignMediumAuto-graded
    Hierarchical Storage Simulator with Auto-Renamed Duplicates

    Simulate an in-memory directory tree with auto-created folders, numbered duplicate file names that respect extensions, content lookup, and sorted listings.

    Data Structure Designdesignhash-mapstring-parsingsimulation
  • Trees & GraphsEasyAuto-graded
    Trace Path to Terminal Node or Cycle Entry

    Determine the final visited node when following single-successor directed edges until reaching a dead end or a previously visited node.

    Trees & Graphstrees-graphsarrayshash-table
  • Trees & GraphsMediumAuto-graded
    Can Every Task Be Scheduled Given Dependency Pairs?

    Tests modeling dependencies as a directed graph and detecting whether a cycle prevents a complete valid ordering, e.g. via indegree-based topological sorting.

    Trees & Graphsgraphtopological-sortcycle-detectionbfs
  • Greedy & IntervalsMediumAuto-graded
    Weekly Deploy Windows with Time Zones and Blackouts

    Convert weekly recurring allow and freeze windows from local time zones to UTC, subtract the freezes, and list the first usable slots after a notice period.

    Greedy & Intervalsintervalssweep-linetime-zonesmodular-arithmetic
  • Data Structure DesignHardAuto-graded
    Cache, Quota Gate and Burst Counter: Batch Operation Runner

    Simulate a batch of operations on an O(1) LFU cache, a fixed-window per-user quota check, and a two-pointer peak request counter.

    Data Structure Designlfu-cacheordered-dictrate-limitingtwo-pointers
  • Heaps, Sorting & SearchMediumAuto-graded
    Maximize Resource Harvest with Linear Depletion

    Find the maximum yield from extracting resources over K time steps when each extraction reduces a site's yield by 1 using binary search on the minimum threshold.

    Heaps, Sorting & Searcharraysheaps-sortinggreedy-intervalsmath-bits
  • Greedy & IntervalsMediumAuto-graded
    Metered Usage Bill with Special Rate Windows

    Compute a total bill over a half-open time window where disjoint special-rate windows replace the default hourly rate, testing interval clipping and boundary handling.

    Greedy & Intervalsintervalssweepmatharrays
  • Greedy & IntervalsMediumAuto-graded
    Analyze Schedule Capacity and Overlaps

    Evaluate interval concurrency to determine if single-resource scheduling is possible and calculate peak concurrent demand.

    Greedy & Intervalsintervalssortingheapsweep-line
  • Math & Bit ManipulationEasyAuto-graded
    Confusion Matrix Scorecard with Safe Division

    Compute precision, recall, specificity, F1 and accuracy from confusion-matrix counts, returning 0.0 for any metric whose denominator is zero.

    Math & Bit Manipulationmetricsconfusion-matrixedge-casesarithmetic
  • Data Structure DesignHardAuto-graded
    Interactive Time Calendar with Pagination and Range Queries

    Process dynamic interval updates, range queries, and ordered pagination operations efficiently.

    Data Structure Designtrees-graphsdesign-dsgreedy-intervals
  • Heaps, Sorting & SearchMediumAuto-graded
    Merge Multiple Sorted Series with Grouping

    Efficiently merge K pre-sorted event logs while combining entries sharing identical timestamps.

    Heaps, Sorting & Searchheaps-sortingarraystwo-pointers
  • Math & Bit ManipulationEasyAuto-graded
    Probability of Keeping Majority Red Items

    Calculates the probability that at least two of three kept items are red when green items are returned upon selection.

    Math & Bit Manipulationmathcombinatoricsprobability
  • Arrays & HashingHardAuto-graded
    Calculate Expected Roll Counts for Target Dice Sequences

    Evaluate expected values for geometric process waiting times and pattern completion using Markov chain state transitions.

    Arrays & Hashingprobabilityexpected-valuemarkov-chainscombinatorics
  • Arrays & HashingEasyAuto-graded
    Find Minimum and Mode of an Integer Array

    Find the minimum element and the most frequent element (mode) in an unsorted list of integers.

    Arrays & Hashingarrayshash-tablefrequency-counting
  • Trees & GraphsHardAuto-graded
    Calculate Subtree Totals in a Tree

    Given an undirected tree and node weights, compute the sum of values for every subtree rooted at node 1.

    Trees & Graphstrees-graphsdfstree-traversalbottom-up
  • Math & Bit ManipulationMediumAuto-graded
    Chance a Daily +/- Walk Ends Below Zero

    Model a price as a two-step random walk, reduce it to a binomial lower tail with a strict cutoff, and sum that tail in a numerically stable way.

    Math & Bit Manipulationprobabilitybinomialnumerical-stabilityrandom-walk