KatInterview

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

Coding Interview Problems

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

6020
Problems
2229
Auto-graded
15
Topics
274
Added today

Showing 1891–1920 of 2782 results

  • Data Structure DesignMediumAuto-graded
    Out-of-Order Loan Event Ledger with Fee-First Payments

    Tests ordered insertion, fee-before-principal payment allocation, and efficient forward-propagation of balance changes when events arrive out of sequence.

    Data Structure Designsimulationsorted-insertdata-structure-design
  • StringsMediumAuto-graded
    Minimum Edits to Form Palindromic Segments

    Tests two-pointer logic and palindrome verification to compute the fewest replacements that transform every fixed-size segment into a palindrome.

    Stringstwo-pointerspalindromegreedy
  • Math & Bit ManipulationMediumAuto-graded
    Overflow-Safe Power with a Custom Modular Multiplier

    Tests whether a candidate can build exponentiation from scratch using only 64-bit-safe addition and multiplication under an arbitrary modulus.

    Math & Bit Manipulationmodular arithmeticbit manipulationexponentiation by squaring
  • Trees & GraphsMediumAuto-graded
    Connected Land Regions on a Grid (8-Direction)

    Tests graph traversal skills by counting connected components in a character grid where land cells are neighbours in all eight directions including diagonals.

    Trees & Graphsgraph traversalBFS/DFSflood fillconnected components
  • StringsMediumAuto-graded
    Verify Anagram Coverage for All Contiguous Substrings

    Tests whether every contiguous substring of length 3 or more in a given string can be rearranged to match some dictionary word.

    Stringsanagramsprefix-sumhashing
  • Math & Bit ManipulationMediumAuto-graded
    Four Numbers, One Target: Arithmetic Reachability

    Tests combinatorial search over arithmetic expressions, exact rational arithmetic, and division-by-zero handling to decide if four numbers can combine to a target.

    Math & Bit Manipulationbacktrackingrecursionmath
  • Data Structure DesignHardAuto-graded
    In-Memory Row Store with Filter, Sort, and Projection

    Tests ability to build a stateful table abstraction that processes insert and query operations with filtering, sorting, and column projection.

    Data Structure Designdesignsimulationsorting
  • Arrays & HashingMediumAuto-graded
    Find All Triplets That Sum to a Target Value

    Tests efficient two-pointer technique with sorted arrays, duplicate handling, and edge-case reasoning.

    Arrays & Hashingtwo-pointerssortingdeduplication
  • Data Structure DesignMediumModel answer
    Random Draw from a Mutable Membership Set in O(1)

    Build a container that registers and removes integer keys and returns a uniformly random current key, all in average constant time.

    Data Structure Designhash-maparrayrandomizedconstant-time
  • Math & Bit ManipulationEasyAuto-graded
    Steady-State Junction Temperature With and Without Heatsink

    Compute a component's junction temperature from power dissipation and series thermal resistances, both before and after adding a heatsink.

    Math & Bit Manipulationthermal-modelingarithmeticembedded-systemssteady-state
  • Heaps, Sorting & SearchMediumAuto-graded
    Grouped Median Property Price by Region

    Tests ability to compute per-group medians over a list of records, correctly handling odd/even counts, duplicate values, and half-up rounding to two decimal places.

    Heaps, Sorting & Searchsortinggroupingmediandecimal-precision
  • Trees & GraphsMediumAuto-graded
    Group Accounts by Shared Identity Fields

    Tests the ability to model transitive relationships between records using Union-Find (DSU) to identify connected components linked by shared attribute values.

    Trees & Graphsunion-findconnected-componentshashing
  • StringsEasyAuto-graded
    Arrange Garment Sizes in Standard Order

    Tests understanding of counting sort for a fixed alphabet, achieving linear time complexity instead of comparison-based sorting.

    Stringscounting-sortstring-manipulationlinear-time
  • Greedy & IntervalsMediumModel answer
    Packing a Fixed-Size Block from a Large Mempool with CPFP

    Design a fee-maximizing transaction selector for a size-capped block, extend it to parent/child dependencies with CPFP scoring, and derive a minimum child fee.

    Greedy & Intervalsgreedyknapsackdependency-trackingcryptocurrency
  • Trees & GraphsMediumModel answer
    Minimum Arrival Time in a Scheduled Transit Network

    Find the earliest time a traveler can reach a destination station given a fixed train timetable, then reconstruct the full itinerary with transfers and waits.

    Trees & Graphsgraph-searchdijkstrabfstime-expanded-graph
  • Data Structure DesignMediumAuto-graded
    Simulate a Fixed-Capacity Recency-Eviction Cache

    Tests whether you can combine a hash map and ordered structure to implement O(1) get/put with least-recently-used eviction on a bounded cache.

    Data Structure Designhash-maplinked-listcachedesign
  • Arrays & HashingMediumAuto-graded
    Longest Circular Run of Ones with One Flip

    Tests sliding window technique on a circular binary array to find the maximum consecutive ones achievable by flipping at most one zero.

    Arrays & Hashingsliding-windowcircular-arraytwo-pointers
  • Heaps, Sorting & SearchMediumAuto-graded
    K Most Common Values in an Array

    Tests frequency counting and top-k selection using hash maps, heaps, or bucket sort, including complexity trade-off reasoning.

    Heaps, Sorting & Searchhash-mapheapbucket-sort
  • Arrays & HashingMediumAuto-graded
    Maximum Vacation Length and Efficient Distinct Value Counting

    Tests sliding window technique for contiguous subarrays with constraints and binary search optimization for counting distinct values in sorted arrays.

    Arrays & Hashingsliding-windowbinary-searchtwo-pointeroptimization
  • Trees & GraphsMediumAuto-graded
    Find the Hub Node in a Star-Shaped Network

    Tests recognition of star-graph topology and the insight that the central node is uniquely identified by its degree.

    Trees & Graphsgraphsdegreestar-graph
  • Arrays & HashingMediumAuto-graded
    Longest Subarray with Bounded Pairwise Spread

    Tests ability to use the two-pointer (sliding window) technique to find the longest contiguous subarray where the difference between the max and min elements stays within a given limit.

    Arrays & Hashingarraystwo pointerssliding window
  • Greedy & IntervalsMediumAuto-graded
    Maximize Total Score by Pairing Players Optimally

    Tests whether a candidate can apply a greedy sort-and-pair strategy to maximize the sum of pair minimums across a list of player ratings.

    Greedy & Intervalsgreedysortingarrays
  • Arrays & HashingHardAuto-graded
    Tiered Subscription Invoice with Mid-Cycle Proration

    Tests ability to combine prorated flat fees with two-tier volume pricing over a half-open time window.

    Arrays & Hashingsimulationmathaggregation
  • StringsMediumAuto-graded
    Longest Uniform Stretch With a Swap Budget

    Tests efficient sliding-window reasoning to find the longest substring that can be made all one character using at most k single-character replacements.

    Stringssliding-windowstringsfrequency-counting
  • Trees & GraphsMediumAuto-graded
    Find the Bottleneck Weight Between Two Nodes

    Compute the smallest possible maximum edge weight along any path connecting two vertices in a weighted undirected graph.

    Trees & Graphsgraphunion-findgreedybottleneck-path
  • Data Structure DesignMediumAuto-graded
    In-Memory Spreadsheet with Formula Evaluation and Cycle Detection

    Build a spreadsheet system that stores values, evaluates formulas referencing other cells, and prevents circular dependencies through pre-write validation.

    Data Structure Designgraphdependency-trackingcycle-detection
  • Arrays & HashingHardAuto-graded
    Experiment Sample Size and Runtime Calculator

    Tests ability to apply the two-sample normal approximation for A/B test sizing and convert a required sample count into a minimum experiment duration.

    Arrays & Hashingstatisticsexperimentationa-b-testing
  • Data Structure DesignMediumModel answer
    File Storage with Quotas, Copy, and Compression

    Build an in-memory file system tracking per-user storage limits, supporting file operations including duplication, compression, and quota-driven eviction.

    Data Structure Designhash-mapheapobject-oriented-designbookkeeping
  • Dynamic ProgrammingHardModel answer
    Two-Station Job Scheduling with Setups and a Downtime Window

    Assign and sequence three jobs across two parallel stations to minimize makespan, handling sequence-dependent changeovers, a precedence constraint, and a station blackout period.

    Dynamic Programmingschedulingcombinatorial-optimizationbranch-and-boundNP-hardness
  • Heaps, Sorting & SearchMediumAuto-graded
    Best Recall Cutoff That Meets a Minimum Precision Target

    Tests threshold search on a scored ranking: find the cut-point that maximises recall while keeping precision at or above a given floor, with correct tie-breaking.

    Heaps, Sorting & Searchsortingprecision-recallbinary-classification