KatInterview

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

Arrays & Hashing Interview Problems

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

5979
Problems
2215
Auto-graded
15
Topics
273
Added today

Showing 181–210 of 437 results

  • Arrays & HashingMediumAuto-graded
    First Long Run of Daily Activity per User

    Group activity logs by user, dedupe dates, find maximal consecutive-day runs of length 7 or more, and report each user's earliest such run.

    Arrays & Hashinghashingdatesgaps-and-islandssorting
  • Arrays & HashingEasyAuto-graded
    Share of Users Who Cancel and Never Come Back

    Group booking records by user, find each canceller's earliest cancellation, and compute the percentage with no later confirmed or returned booking.

    Arrays & Hashinghash-maptimestampsgroupingpercentage
  • Arrays & HashingMediumAuto-graded
    Runner-Up Label by Frequency Tier in a Flat Record List

    Count labels in every third slot of a flat list, find the second-highest distinct count, and break ties by earliest appearance.

    Arrays & Hashinghash-mapcountingfrequencytie-breaking
  • Arrays & HashingEasyAuto-graded
    Locate Two Entries Adding Up to a Goal Value

    Find two different positions in an integer list whose values sum to a goal, using a deterministic tie-break rule, which tests complement lookup with a hash map.

    Arrays & Hashinghash-maparraycomplement-lookuptwo-sum
  • Arrays & HashingMediumAuto-graded
    Merge Mutual Connections Into Earliest-Confirmed Pairs

    Tests normalizing undirected pairs, filtering pending rows, and keeping the earliest date per pair from a list of event dictionaries, with deterministic sorted output.

    Arrays & Hashinghash-mapgroupingnormalizationsorting
  • Arrays & HashingEasyAuto-graded
    Yearly Account Balance with Conditional Monthly Service Charges

    Simulate a year of account activity, applying a flat monthly charge unless a month has enough payments with a large enough total, and return the final balance.

    Arrays & Hashingsimulationhash-mapaggregationconditional-logic
  • Arrays & HashingMediumAuto-graded
    Forced Winner in Complete and Incomplete Card Hands

    Rank five-card hands with a tuple key, then decide whether an outcome is forced across all ways to fill in missing cards.

    Arrays & Hashingsimulationcombinatoricscountingtie-breaking
  • Arrays & HashingEasyAuto-graded
    Triple Array Toolkit: Lookup, Increment, Zero Shift

    Combines a binary search on a sorted list, adding one to a digit-array number with carry, and a stable in-place move of zeros to the back.

    Arrays & Hashingbinary-searchtwo-pointerscarryin-place
  • Arrays & HashingMediumAuto-graded
    Mean Front-to-Rear Lens Flips Across Recorded Sessions

    Group event logs by session, sort chronologically, count adjacent front-then-rear transitions, and average over all sessions, including sessions with zero flips.

    Arrays & Hashinghash-mapgroupingsortingsimulation
  • Arrays & HashingEasyAuto-graded
    Earliest Non-Repeating Event Name in a Sequence

    Find the earliest entry in a list of strings that occurs exactly once overall, or return an empty string, testing frequency counting combined with preserved order.

    Arrays & Hashinghash-mapcountingstringstwo-pass
  • Arrays & HashingEasyAuto-graded
    Locate the Two Positions That Add Up to a Goal Value

    Find the single pair of distinct positions in an integer list whose values add up to a goal, using a one-pass lookup instead of checking every pair.

    Arrays & Hashinghash-maparraycomplement-lookup
  • Arrays & HashingEasyAuto-graded
    Per-Row Offset From Group Average in a Record List

    Tests group-then-broadcast logic: compute each group's mean over a list of dict records, then attach each row's difference from its group mean while preserving order.

    Arrays & Hashinghash-mapgroup-byaggregationsimulation
  • Arrays & HashingEasyAuto-graded
    Filter Events per Subscriber with Named Rules

    Apply an ordered list of named filter rules to every user-event pair and build a per-user list of qualifying event ids, handling missing prices, empty rule lists and unknown rule names.

    Arrays & Hashinghash-mapsimulationfilteringstrategy-pattern
  • 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 & 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