KatInterview

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

Arrays & Hashing Interview Problems

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

5981
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 211–240 of 437 results

  • Arrays & HashingMediumAuto-graded
    Peak Pace Over Tightest 1000-Meter Windows in Interval Logs

    Sliding-window problem: for each end index find the shortest suffix with at least 1000 meters, compute its average speed, and return the maximum across all end indices.

    Arrays & Hashingsliding-windowtwo-pointersprefix-sumsarrays
  • Arrays & HashingEasyAuto-graded
    Roster Screening with Optional Age, Pay, and Job Limits

    Scan a list of employee records and keep those meeting every enabled optional range or membership rule, preserving order and leaving the input untouched.

    Arrays & Hashingfilteringhash-setoptional-parameterssimulation
  • Arrays & HashingMediumAuto-graded
    Batch Gradient Descent Linear Regression Session Simulator

    Simulate a fit/predict command sequence for a linear model trained with batch gradient descent on mean squared error, using plain Python lists.

    Arrays & Hashinggradient-descentlinear-regressionmsesimulation
  • Arrays & HashingMediumAuto-graded
    Remainder-Sum Windows and Bracket Cleanup

    Count contiguous subarrays whose sum has a given remainder using prefix-sum remainders, and delete the fewest parentheses to balance a string in a fixed, deterministic way.

    Arrays & Hashingprefix-summodular-arithmetichash-countinggreedy
  • Arrays & HashingMediumAuto-graded
    Reconcile Payments Against Open Invoices in Three Tiers

    Process payments in order, pairing each with an invoice by ID plus amount, then by unique amount, then by closest amount within a percentage tolerance.

    Arrays & Hashinghash-mapsimulationmatchingfloating-point
  • Arrays & HashingEasyAuto-graded
    Sliding Marble on a Tiltable Grid with Scheduled Tilts

    Simulate a marble on a grid whose tilt changes at scheduled times, and find its final cell efficiently when the end time can reach a billion seconds.

    Arrays & Hashingsimulationgridtime-segmentstwo-pointers
  • Arrays & HashingMediumAuto-graded
    Best Single Round-Trip Gain Across Tickers in an Unordered Log

    Find the largest gain from buying and later selling the same ticker on a strictly later date, given an unsorted log with duplicate dates; tests grouping, sorting and careful running-minimum updates.

    Arrays & Hashinghash-mapsortinggreedytime-series
  • Arrays & HashingEasyAuto-graded
    Count Repeated Strings in a Large List

    Tests hash-map frequency counting: find every string occurring more than once in a list and report its count, using exact comparison.

    Arrays & Hashinghash-mapcountingstringsfrequency
  • Arrays & HashingEasyAuto-graded
    Tally Tokens and Report the Three Most Common

    Count occurrences of each string in a list with a hash map, then rank by count with an alphabetical tie-break to extract the top three entries.

    Arrays & Hashinghash-mapcountingsortingtie-breaking
  • Arrays & HashingMediumAuto-graded
    Users Needed Per Group for a Two-Proportion Test

    Compute the smallest equal group size for a two-sided two-proportion z-test, given a baseline rate, relative uplift, significance level and target power.

    Arrays & Hashingstatisticssample-sizepower-analysisab-testing
  • Arrays & HashingMediumAuto-graded
    Window Sums Within [k, 2k] for Power-of-Two Lengths

    Enumerate every subarray whose length is a power of two and whose sum falls in [k, 2k], using prefix sums to get an O(n log n) solution with ordered output.

    Arrays & Hashingprefix-sumsliding-windowsubarrayenumeration
  • Arrays & HashingMediumAuto-graded
    Deterministic Mini-Batch Gradient Descent for a Line Fit

    Fit a slope and intercept to 2D points by running deterministic mini-batch gradient descent on mean squared error, with exact batching, update order and edge-case rules.

    Arrays & Hashinggradient-descentlinear-regressionmini-batchoptimization
  • Arrays & HashingMediumAuto-graded
    Rank Among Values Occurring Once Across Two Lists

    Count occurrences across two combined lists, keep values seen exactly once, and return the k-th largest of them or -1 if there are fewer than k.

    Arrays & Hashinghash-mapcountingsortingheap
  • Arrays & HashingMediumAuto-graded
    Fill a Padded Sorted Buffer from a Second Sorted List

    Merge two sorted lists into the first, which has trailing spare slots, without extra memory; tests back-to-front two-pointer merging.

    Arrays & Hashingtwo-pointersin-placesortingmerge
  • Arrays & HashingEasyAuto-graded
    Bump a Digit-Array Number Up by One

    Increment a large non-negative number stored as a digit list by one, handling carry propagation and length growth without converting to an integer.

    Arrays & Hashingarrayscarrysimulationmath
  • Arrays & HashingMediumAuto-graded
    Probability Toolkit: Gamble Moments, Dice, Arrivals, Odds, Draws

    Compute expected value and variance, a dice conditional probability, a Poisson tail, betting edge with Kelly sizing, and a without-replacement card probability in one function.

    Arrays & Hashingprobabilityexpected-valueconditional-probabilitypoisson
  • Arrays & HashingEasyAuto-graded
    Rolling window totals over filtered records in input order

    Tests filtering a list of tagged records and computing rolling window totals in O(n) using an incremental sum instead of recomputing each window.

    Arrays & Hashingsliding-windowprefix-sumfilteringarrays
  • Arrays & HashingMediumAuto-graded
    Detect a Run of Two or More Elements Summing to a Multiple of k

    Tests prefix-sum reasoning with hashing: detecting a contiguous run of length at least two whose sum is divisible by k, including the k = 0 special case.

    Arrays & Hashingprefix sumhash mapremainderssubarray
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • Arrays & HashingEasyAuto-graded
    Paginated Sensor-Alert Filter with Validation

    Tests ability to validate, filter, sort, and paginate structured records while handling malformed entries and boundary conditions correctly.

    Arrays & Hashingarraysfilteringpagination
  • Arrays & HashingMediumAuto-graded
    Bayesian Guessing Game with Unknown Coin Bias

    Compute expected optimal winnings when sequentially guessing coin flips with a uniform-prior unknown bias.

    Arrays & Hashingprobabilitybayesianexpected-valuedynamic-programming