KatInterview

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

Coding Interview Problems

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

6036
Problems
2235
Auto-graded
15
Topics
273
Added today

Showing 1651–1680 of 2788 results

  • Data Structure DesignMediumModel answer
    One-Edit Word Lookup and Vertical Tree Traversal

    Design a data structure for single-character substitution queries, then output a binary tree's node values sorted by column, row, and left-to-right order.

    Data Structure Designhashingtriebinary-treebfs
  • Trees & GraphsMediumModel answer
    Minimum Spread Time for Contamination in a Grid

    Find how many steps a contamination spreads from multiple sources through a grid, or determine if some cells remain permanently unaffected.

    Trees & GraphsBFSmulti-source BFSgrid traversalshortest path
  • Greedy & IntervalsHardAuto-graded
    Maximize Paired Sum with Coverage Constraint

    Tests greedy reasoning and sorting to maximize the sum of "lesser" elements across a constrained pairing of an even-length array.

    Greedy & Intervalsgreedysortingarrays
  • Arrays & HashingMediumAuto-graded
    Longest Contiguous Subarray with a Target Sum

    Tests prefix-sum reasoning, hash-map lookups, and precise tie-breaking to find the longest subarray summing to exactly k.

    Arrays & Hashingprefix-sumshash-maparrays
  • Data Structure DesignHardAuto-graded
    Versioned Membership Tracker with Point-in-Time Queries

    Tests ability to design a copy-on-write set that records per-element change history and answers historical membership queries in O(log n) via binary search.

    Data Structure Designbinary searchdesignhash map
  • Data Structure DesignMediumAuto-graded
    Sliding Window Request Rate Calculator

    Tests the ability to implement time-bucketed sliding-window aggregation with efficient memory usage and amortized constant-time operations.

    Data Structure Designsliding-windowtime-seriesdata-structuresamortized-analysis
  • Data Structure DesignHardModel answer
    Live Spreadsheet with Eager Caching and Cycle Guards

    Build a spreadsheet engine where every write pre-computes all downstream values so reads are O(1) cache lookups, and circular definitions are rejected atomically.

    Data Structure Designgraphstopological-sortcycle-detectiondependency-tracking
  • Data Structure DesignMediumAuto-graded
    Sliding Window Event Log with Time-Based Expiration

    Design a data structure that tracks timestamped events and supports queries over a moving time window with automatic expiration of old entries.

    Data Structure Designsliding-windowqueuestime-seriesdata-structures
  • StringsMediumAuto-graded
    Minimum Window Containing All Required Characters

    Tests sliding window technique with character frequency tracking to find the smallest substring that satisfies multiplicity constraints.

    Stringssliding-windowtwo-pointershash-map
  • StringsMediumModel answer
    Config-Driven CSV Validator with Name Overlap Check

    Write a configurable validator that flags missing fields, length violations, banned words, and low name-word overlap across CSV vendor rows.

    Stringscsv-parsingvalidationregextext-normalization
  • StringsMediumAuto-graded
    Parse and Validate Business Registration CSV Records

    Tests multi-rule sequential validation over CSV rows: field presence, tax ID format normalization, and fuzzy owner name matching via token overlap.

    Stringsstringsparsingvalidation
  • Data Structure DesignMediumModel answer
    Build an In-Memory Key-Value Store with Savepoints

    Design a transactional key-value store supporting nested transactions, named savepoints, and full rollback using an undo-log approach.

    Data Structure Designtransactionsundo-logkey-value-storenested-transactions
  • Trees & GraphsMediumAuto-graded
    Balance Root-to-Leaf Path Sums in Binary Tree

    Tests bottom-up tree traversal with greedy balancing, recognizing that shared ancestors minimize total increments across multiple paths.

    Trees & Graphsbinary-treegreedypost-order-traversaltree-dp
  • Data Structure DesignMediumAuto-graded
    Aggregate Sales Data with Running and Grand Totals

    Tests dictionary aggregation, deterministic ordering, and building cumulative totals along two dimensions from grouped records.

    Data Structure Designaggregationdictionariesdata-processing
  • Math & Bit ManipulationMediumModel answer
    Square Root by Newton's Method and Odd/Even Index Partitioning

    Implement sqrt from scratch with range reduction plus Newton's method, and rearrange an array in O(1) space so even-positioned values all beat odd-positioned ones.

    Math & Bit Manipulationnewton-methodquickselectin-place-partitionnumerical-precision
  • StringsMediumAuto-graded
    Count Balanced Two-Block Substrings in a Binary String

    Tests whether a candidate can group consecutive identical characters into runs and use adjacent run lengths to efficiently count valid balanced substrings.

    Stringsstringstwo-pointersrun-length-encoding
  • Data Structure DesignMediumModel answer
    Build a FIFO Queue: Compare Linked List, Array, and Ring Buffer

    Implement a queue with enqueue, dequeue, peek, and isEmpty. Compare linked list, dynamic array, and circular buffer approaches.

    Data Structure Designqueuedata-structurescomplexity-analysismemory-management
  • Trees & GraphsMediumModel answer
    Trace a Target String Through a Character Grid

    Decide whether a word can be spelled by a non-repeating, four-directional path of adjacent cells in a character matrix, with pruning and complexity analysis.

    Trees & Graphsbacktrackingdepth-first-searchgridpruning
  • Dynamic ProgrammingMediumModel answer
    Stock Trading Profit with Transaction Limits and Fees

    Maximize stock trading profit given a cap on total transactions and a per-sale fee, using a unified DP state machine.

    Dynamic Programmingdynamic-programmingstate-machinegreedy
  • Trees & GraphsMediumAuto-graded
    Minimum Steps Through an Obstacle Map

    Tests ability to model a 2D grid as an unweighted graph and apply BFS to find the fewest moves between two corners while avoiding walls.

    Trees & Graphsbfsgraphsgrid
  • Data Structure DesignMediumAuto-graded
    Simulated Word Store with Prefix Query

    Tests trie-style prefix counting logic via operation replay, with optional case-insensitive and trailing-digit normalization flags.

    Data Structure Designtriestringssimulation
  • Heaps, Sorting & SearchMediumAuto-graded
    Find k Nearest Values in Sorted Array

    Tests binary search on window positions with careful tie-breaking that prefers smaller values when distances are equal.

    Heaps, Sorting & Searchbinary-searchsliding-windowtwo-pointers
  • Data Structure DesignHardAuto-graded
    Running Median Over a Live Integer Feed

    Tests whether a candidate can design a two-heap structure that inserts integers and queries the running median in better than O(N) time per operation.

    Data Structure Designheapsdesignstreaming
  • Trees & GraphsMediumAuto-graded
    Count Land Cells in a Connected Region

    Tests iterative graph traversal (DFS/BFS) on a binary grid, including bounds handling, visited-marking strategy, and complexity analysis.

    Trees & Graphsgraph traversalDFSBFSmatrix
  • Arrays & HashingEasyAuto-graded
    Aggregate Parallel Pipeline Results Safely

    Fix async pool usage so results are collected in order, worker errors surface, and one JSON file is written.

    Arrays & Hashingmultiprocessingconcurrencydebuggingfile-io
  • Arrays & HashingMediumAuto-graded
    Compress Sorted Array to Unique Elements

    Tests in-place array manipulation with two-pointer technique to remove duplicates from a sorted sequence.

    Arrays & Hashingtwo-pointersin-placesorted-array
  • Data Structure DesignMediumAuto-graded
    Mini Query Engine: Filter, Sort, and Project Rows

    Tests ability to implement a pipeline of filter, multi-column sort, and column projection over a list of in-memory row dicts.

    Data Structure Designdata structuressortingfiltering
  • Heaps, Sorting & SearchMediumAuto-graded
    Weighted Lottery Ticket Assignment

    Tests prefix sums and binary search to map ticket numbers into population-weighted ranges efficiently.

    Heaps, Sorting & Searchbinary-searchprefix-sumsarrays
  • Heaps, Sorting & SearchMediumAuto-graded
    Sorted Sensor Readings: Answer Interval Coverage Queries

    Tests binary search on sorted arrays with duplicates to answer multiple inclusive range queries in O(log n) per query.

    Heaps, Sorting & Searchbinary-searcharraystwo-pointers
  • Heaps, Sorting & SearchMediumAuto-graded
    Find the K-th Largest Element Without Using a Heap

    Tests implementation of quickselect to find the k-th largest value in an unsorted array, treating duplicates as separate elements.

    Heaps, Sorting & Searchquickselectpartitioningselection-algorithms