KatInterview

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

Arrays & Hashing Interview Problems

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

5980
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 211–240 of 477 results

  • Arrays & HashingEasyAuto-graded
    Leftmost Column Containing a One in Row-Sorted Grid

    Find the leftmost column holding a 1 in a binary grid whose rows are sorted, aiming for a linear-time walk instead of scanning every cell.

    Arrays & Hashingmatrixtwo-pointersbinary-matrixstaircase-search
  • Arrays & HashingMediumAuto-graded
    Weekly Power-User Share per Country from Impression Logs

    Group impression records by country and user over a 7-day window, flag users with 4+ active dates and 3+ surfaces on one date, and report per-country percentages.

    Arrays & Hashinghash-mapgroupingsetsdate-handling
  • Arrays & HashingMediumAuto-graded
    Shortest Block to Cut for a Non-Decreasing Remainder

    Find the shortest contiguous block whose removal leaves a non-decreasing array, using sorted prefix/suffix boundaries and two pointers, with a smallest-start tie-break.

    Arrays & Hashingtwo-pointersarraysprefix-suffixgreedy
  • Arrays & HashingMediumAuto-graded
    Cross-Array Pair Sum Check on Two Ordered Lists

    Decide whether one value from each of two sorted lists adds up to a target, using a linear-time opposite-direction two-pointer scan with constant extra space.

    Arrays & Hashingtwo-pointerssorted-arraystwo-sumoverflow-safety
  • Arrays & HashingEasyAuto-graded
    Horvitz-Thompson Event Rate from Weighted Inspection Records

    Estimate a population-wide event rate from samples drawn with known unequal inclusion probabilities, using inverse-probability weighting divided by the population size.

    Arrays & Hashinginverse-probability-weightingsamplingestimationhorvitz-thompson
  • Arrays & HashingMediumAuto-graded
    Rover on a Walled Floor Plan with Blocked Cells

    Simulate a rover on a bounded rectangular grid that turns, steps forward, and steps backward, skipping any step that leaves the grid or enters a blocked cell.

    Arrays & Hashingsimulationhash-setgridmodular-arithmetic
  • Arrays & HashingMediumAuto-graded
    Balanced Alternating Sums After One Removal

    Count positions whose removal makes the sum at even positions equal the sum at odd positions, testing prefix/suffix sums and the parity shift after a deletion.

    Arrays & Hashingprefix-sumsparityarraycounting
  • Arrays & HashingEasyAuto-graded
    Category Revenue and Fulfillment Report from Three Tables

    Join order, product and category records, group by category name, and compute total revenue, mean revenue per row and the share of completed rows, using hash maps.

    Arrays & Hashinghash-mapaggregationjoingrouping
  • Arrays & HashingMediumAuto-graded
    Card Authorization Report with Time-Activated Block Rules

    Sort card authorization events by time and apply permanent, time-activated block rules to label each as APPROVE or REJECT, testing stable sorting, two-stream merging and hashing.

    Arrays & Hashinghashingsortingsimulationtwo-pointers
  • Arrays & HashingMediumModel answer
    Merging k Key-Value Maps: Conflict Rules and Efficient Design

    Design a way to merge two key-value maps, extend it to k maps, and decide which conflict rules must be pinned down before writing any code.

    Arrays & Hashinghash-mapmergingapi-designclarifying-questions
  • Arrays & HashingMediumAuto-graded
    Column-wise Gap Filling with Mean, Median or Mode

    Fill None cells in a table column by column with the mean, median or smallest-most-frequent value of the observed entries, without mutating the input.

    Arrays & Hashingarrayssimulationstatisticsdata-cleaning
  • Arrays & HashingHardAuto-graded
    Complete a Partially Filled Number Grid with Row, Column, Box Rules

    Fill in the blanks of a 9x9 digit grid so every row, column and 3x3 block holds each digit 1-9 once, testing backtracking with constraint pruning.

    Arrays & Hashingbacktrackingconstraint-satisfactionbitmaskrecursion
  • Arrays & HashingMediumAuto-graded
    Rainwater Held Between Terrain Columns

    Compute total rainwater stored between unit-width columns of given heights, aiming for a single pass with constant extra memory using the two-pointer technique.

    Arrays & Hashingtwo-pointersarraysgreedy
  • Arrays & HashingEasyAuto-graded
    Locate Two Entries That Add Up to a Goal

    Find the two distinct positions in an integer list whose values sum to a goal, using a single-pass hash map lookup instead of checking every pair.

    Arrays & Hashinghash-maparrayscomplement-lookup
  • Arrays & HashingEasyAuto-graded
    Experiment Sizing and Beta Posterior Update

    Compute the per-group sample size for a two-proportion test from a given formula, and update a Beta prior with observed Bernoulli outcomes.

    Arrays & Hashingstatisticspower-analysisbayesian-updatebeta-binomial
  • Arrays & HashingEasyAuto-graded
    Top Five Senders and Receivers From Signed Transfer Logs

    Count senders and receivers from signed transfer records in a single pass, then pick the five most frequent on each side with a deterministic tie-break.

    Arrays & Hashinghash-mapcountingheapstreaming
  • Arrays & HashingMediumAuto-graded
    Interleave Signs With Stable Order and Trailing Zeros

    Build a new list that alternates positives and negatives (starting positive), keeps same-sign order, appends leftover elements, and places zeros last.

    Arrays & Hashingarraystwo-pointersstable-partitionsimulation
  • Arrays & HashingMediumAuto-graded
    Target-Sum Windows and Largest Building Cluster

    Combine a prefix-sum hash map to count contiguous slices summing to a target with a grid flood fill to find the largest 4-connected cluster of buildings.

    Arrays & Hashingprefix-sumhash-mapflood-fillgrid
  • 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 & HashingMediumModel answer
    Randomly Fill Ad Slots Under Per-User View Caps

    Randomly assign eligible ads to page positions for one user, respecting per-user display caps, avoiding repeats when possible, and returning the updated view counts.

    Arrays & Hashingrandomizationhash-mapshuffleresource-allocation
  • 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