KatInterview

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

Interview Practice Problems

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

6002
Problems
2223
Auto-graded
15
Topics
273
Added today

Showing 571–600 of 2223 results

  • Dynamic ProgrammingMediumAuto-graded
    Smallest Sentence from a Spaceless String and Word List

    Segment a spaceless string into dictionary words and return the lexicographically smallest valid sentence, or None if impossible; tests suffix DP plus greedy reconstruction.

    Dynamic Programmingdynamic-programmingstringsgreedyword-break
  • Arrays & HashingEasyAuto-graded
    Repair a Sensor Log: Merge, Sort, and Interpolate Gaps

    Merge duplicate timestamps by averaging known readings, sort, then fill missing values by linear interpolation inside gaps and nearest-value holding at the ends.

    Arrays & Hashinghash-mapsortinginterpolationtime-series
  • StringsMediumAuto-graded
    Does This Shorthand Describe the Word?

    Check whether a shorthand of letters and skip counts exactly describes a word, handling multi-digit counts, leading zeros, overruns and leftover characters with a two-pointer scan.

    Stringstwo-pointersstring-parsingsimulation
  • Data Structure DesignMediumAuto-graded
    Word Index with Prefix Queries and Ordered Suggestions

    Simulate a command sequence on a word index that supports insert, exact lookup, prefix lookup, and alphabetically ordered, capped autocomplete, built on a trie.

    Data Structure Designtriedesigndfsstrings
  • Data Structure DesignEasyAuto-graded
    Ledger Simulator with Holds, Deferred Payments and Cancellations

    Simulate a small in-memory bank driven by a command script, covering account creation, instant and deferred transfers, batch settlement and cancellation of pending transfers.

    Data Structure Designsimulationhash-mapstate-managementclass-design
  • Stacks & QueuesEasyAuto-graded
    Check Whether Bracket Pairs Are Correctly Nested

    Decide whether a string of round, square and curly brackets is well formed, which tests the use of a stack for last-in-first-out matching.

    Stacks & Queuesstackstringsparsing
  • Math & Bit ManipulationEasyAuto-graded
    Single Row of the Binomial Triangle in Linear Space

    Compute one row of Pascal's triangle by index, using only space proportional to the row, via an in-place update or the multiplicative binomial recurrence.

    Math & Bit Manipulationpascal-trianglecombinatoricsdynamic-programmingarrays
  • Trees & GraphsMediumAuto-graded
    Tally Separate Clusters of Occupied Cells in a Grid

    Count groups of orthogonally touching '1' cells in a character grid, a connected-components task solved with an iterative flood fill or union-find.

    Trees & Graphsgraphbfsgridconnected-components
  • Data Structure DesignMediumAuto-graded
    Hourly Courier Pay Ledger with Settlement Watermark

    Simulate a payroll ledger that records work intervals, tracks accrued cost, and settles wages up to a cutoff time without double-paying.

    Data Structure Designdesignsimulationintervalsidempotency
  • Arrays & HashingEasyAuto-graded
    Pair Sum Existence Check in an Integer List

    Decide whether any two elements at different positions in an integer list add up to a given value, testing hash-set lookups and careful handling of duplicates.

    Arrays & Hashinghash-settwo-sumarrayscomplement
  • Data Structure DesignMediumAuto-graded
    Replay Commands on a Fixed-Bucket Key-Value Store

    Simulate a hand-built key-value store with a fixed bucket count by replaying a command log, handling collisions and overwrites correctly without a built-in dictionary.

    Data Structure Designhash-tableseparate-chainingsimulationdesign
  • SQL & DataMediumAuto-graded
    Analyze Live Streaming Telemetry and Viewing Events

    Process minute-level streaming activity and viewer events to calculate time-series metrics, category shares, month-over-month growth, and joined yearly summaries.

    SQL & Datadata-aggregationtime-seriesjoinsanalytics
  • Dynamic ProgrammingMediumAuto-graded
    Longest Eastward Chain of Cities from Raw CSV Text

    Parse CSV text with quoted fields, then find the longest chain of cities with increasing longitude and non-decreasing latitude, breaking ties by the smallest list of names.

    Dynamic Programmingcsv-parsinglongest-increasing-subsequencedag-dplexicographic-tiebreak
  • Data Structure DesignMediumAuto-graded
    Ticket Ranges: Find the Bucket Owning Each Draw

    Map integer draws to the index whose cumulative weight range contains them, using prefix sums and binary search, driven through a batch of init/query operations.

    Data Structure Designprefix-sumbinary-searchdesignbisect
  • Dynamic ProgrammingMediumAuto-graded
    Optimal Closed Tour Cost Across Directed Locations

    Find the minimum cost to complete a full circuit starting and ending at node 0, visiting all other nodes exactly once with asymmetric leg costs.

    Dynamic Programmingdynamic-programmingbit manipulationgraph
  • Data Structure DesignMediumAuto-graded
    Closest Pair Gaps Between Words in a Fixed List

    Answer many closest-index-distance queries over a fixed word list by building a position index, precomputing same-word gaps, and binary searching the smaller list.

    Data Structure Designinverted-indexbinary-searchpreprocessinghash-map
  • Linked ListsMediumAuto-graded
    Flip Every Complete Block of K in a Sequence

    Reverse each full consecutive block of k items in a list, leaving a shorter leftover tail unchanged; tests pointer-style reversal logic and boundary handling.

    Linked Listslinked-listin-place-reversaltwo-pointerssimulation
  • Heaps, Sorting & SearchMediumAuto-graded
    Top K Highest Scores in Descending Order

    Select the k greatest values from an unsorted integer list, duplicates included, returned from largest to smallest, ideally in O(n log k) time using a bounded min-heap.

    Heaps, Sorting & Searchheaptop-ksortingarrays
  • Greedy & IntervalsMediumAuto-graded
    Fewest Brackets to Add for a Balanced String

    Count the fewest parenthesis insertions needed to make a string of brackets balanced, using a single left-to-right pass with a running counter.

    Greedy & Intervalsgreedystringsparenthesescounter
  • Trees & GraphsMediumAuto-graded
    Find Minimum Network Distance Between Users

    Compute the shortest path distance between two nodes in an unweighted undirected graph using Breadth-First Search.

    Trees & Graphsbfsgraphshortest-pathbreadth-first-search
  • Trees & GraphsMediumAuto-graded
    Reconstruct Alphabet Order from Sorted Vocabulary

    Determine character precedence in an unfamiliar alphabet using a sorted list of terms, returning the lexicographically first valid character sequence or an empty string for invalid inputs.

    Trees & Graphstrees-graphsheaps-sortingstrings
  • Dynamic ProgrammingMediumAuto-graded
    Stock Trading With a Per-Sale Commission

    Compute the best total gain from repeatedly buying and selling a single share of a stock when each sale costs a flat commission, using a two-state dynamic program.

    Dynamic Programmingdynamic-programmingstate-machinestocksgreedy
  • Arrays & HashingMediumAuto-graded
    Prefix Value Blocks in a Shuffled Sequence

    Decide, for every k, whether the values 1..k occupy a contiguous block of a permutation, using value positions and a running span instead of scanning subarrays.

    Arrays & Hashingpermutationindex-mappingrunning-min-maxstring-output
  • Dynamic ProgrammingMediumAuto-graded
    Rearrangements of 1..m With a Fixed Number of Out-of-Order Pairs

    Count arrangements of 1..m with exactly n out-of-order pairs, modulo 10^9+7, using a DP over insertion positions optimized with a sliding-window sum.

    Dynamic Programmingdynamic-programmingcombinatoricspermutationssliding-window
  • StringsEasyAuto-graded
    Earliest Non-Repeating Character with Optional Case Folding

    Find the position of the earliest character that occurs exactly once in a string, with a flag that switches between case-sensitive and case-insensitive matching.

    Stringsstringshash-mapcountingcase-folding
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Expected Return from Two Six-Sided Dice

    Computes the expected payoff of a game played with two independent six-sided dice, rounded to two decimal places.

    Math & Bit Manipulationmath-bitsprobabilitysimulation
  • StringsMediumAuto-graded
    List Every Well-Formed Bracket Sequence in Dictionary Order

    Enumerate all well-formed bracket sequences using n pairs, returned in dictionary order, testing pruned backtracking and reasoning about output ordering.

    Stringsbacktrackingrecursioncombinatoricsstrings
  • Arrays & HashingMediumAuto-graded
    Quarter-Turn a Square Grid of Pixels Without Extra Storage

    Turn a square integer grid a quarter turn clockwise by modifying it in place, testing index mapping and in-place transforms such as transpose plus row reversal.

    Arrays & Hashingmatrixin-placesimulationtranspose
  • Math & Bit ManipulationEasyAuto-graded
    Yearly Earnings Report for a Rewards Membership Program

    Compute yearly revenue, cost, profit and per-member profit for a membership program from fees, monthly spend commission, and fixed and variable costs.

    Math & Bit Manipulationmatharithmeticunit-conversionsimulation
  • Trees & GraphsMediumAuto-graded
    Fewest Removals to Cap a Rooted Tree's Height

    Count the minimum non-root nodes to remove from a parent-array tree, splicing children upward, so the height is at most a limit; tests subtree heights and a path-decomposition argument.

    Trees & Graphstreesubtree-heightiterative-bfsgreedy