KatInterview

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

Arrays & Hashing Interview Problems

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

5967
Problems
2210
Auto-graded
15
Topics
272
Added today

Showing 31–60 of 475 results

  • Arrays & HashingMediumAuto-graded
    Tally Contiguous Segments Matching a Goal Total

    Count contiguous non-empty segments of an integer array whose sum equals a goal, using running totals and a frequency map to handle negatives and zeros in linear time.

    Arrays & Hashingprefix-sumhash-mapsubarraycounting
  • Arrays & HashingEasyAuto-graded
    Simulate Key-Value Operations

    Process a series of insertion, update, and deletion instructions on a key-value store and return the final contents ordered by key.

    Arrays & Hashingarraysstringshash-table
  • Arrays & HashingMediumAuto-graded
    Closest Response Times: List the Tightest Increasing Pairs

    Find the smallest absolute gap between any two readings, then list every strictly increasing pair achieving it, handling duplicates correctly. Tests sorting and adjacent-gap reasoning.

    Arrays & Hashingsortingarraysadjacent-differenceedge-cases
  • Arrays & HashingMediumAuto-graded
    Keep Words Whose Letter Multiset Appears More Than Once

    Filter a word list to the entries whose letter multiset is shared by at least two entries, keeping input order and duplicates, using letter-count keys.

    Arrays & Hashinghash-mapanagramscountingstrings
  • Arrays & HashingEasyAuto-graded
    Leaked Allocations: Filter Blocks Missing From Live Pointers

    Filter a list of allocated block addresses to those absent from a list of live pointers, keeping the original order, using hash-set membership for linear-time performance.

    Arrays & Hashinghash-setfilteringorder-preservationarrays
  • Arrays & HashingHardModel answer
    Distinct Subset Sums With Negatives and Repeated Values

    List every distinct multiset of array values, each index used at most once, that sums to a target when negatives, zeros and duplicates are present. Output must be sorted.

    Arrays & Hashingbacktrackingpruningdeduplicationsubsets
  • Arrays & HashingEasyAuto-graded
    Enumerate Every Settings Grid from Option Lists

    Build the Cartesian product of named option lists into a list of dictionaries, handling empty inputs and a defined output order.

    Arrays & Hashingcartesian-productbacktrackingitertoolsdictionaries
  • Arrays & HashingMediumAuto-graded
    Tally Orders per Customer by Status Column

    Group order records by customer and count how many fall into each requested status, producing one sorted, zero-filled row per customer.

    Arrays & Hashinghash-mapgroupingcountingsorting
  • Arrays & HashingMediumAuto-graded
    Richest Window of Stalls Under Count and Distance Limits

    Find the best sum over a contiguous run of position-sorted items, limited by item count and coordinate span, using sorting and a two-pointer sweep.

    Arrays & Hashingsliding-windowtwo-pointerssortingprefix-sums
  • Arrays & HashingEasyAuto-graded
    Select Stale Replica Files for Copying

    Filter a list of source file records against destination records using readability, writability, size and timestamp rules, returning names in source order.

    Arrays & Hashinghash-mapfilteringsimulation
  • Arrays & HashingEasyAuto-graded
    Count Distinct Engaged Ads Per Day from an Event Log

    Tests filtering an event log by type, grouping by date, counting distinct ids with sets, and returning date-sorted results while omitting dates that have no qualifying events.

    Arrays & Hashinghash-mapsetgroupingsorting
  • Arrays & HashingMediumAuto-graded
    Sliding Token on a Grid with Timed Heading Changes

    Compute a token's final cell on a grid with blocked cells when its heading changes at given timestamps up to 10^9, which requires processing time segments instead of simulating each tick.

    Arrays & Hashingsimulationgridintervalslarge-input
  • Arrays & HashingMediumAuto-graded
    Sliding Window Maxima on a Grid With Source Positions

    Slide a square window over an integer grid with a given step, and report each window's maximum with its grid coordinates, resolving ties by the smallest row, then the smallest column.

    Arrays & Hashingmatrixsliding-windowsimulationtie-breaking
  • Arrays & HashingEasyAuto-graded
    Coupon Usage Caps: Check Remaining Redemptions per User

    Count past coupon redemptions per (user, coupon) pair from a log, then answer many read-only queries on whether each user is still under the coupon's cap.

    Arrays & Hashinghash-mapcountingaggregationcomposite-key
  • Arrays & HashingMediumAuto-graded
    Earliest-Completing Pair That Hits a Target Sum

    Find the pair of indices whose values sum to a target, choosing the pair that finishes earliest in the array, with deterministic duplicate handling, using a one-pass hash map.

    Arrays & Hashinghash-maptwo-sumduplicatesone-pass
  • Arrays & HashingEasyAuto-graded
    Mean Household Earnings with Gaps in the Data

    Compute the mean of a list of numbers while skipping None and NaN entries, returning 0.0 when nothing valid remains and rounding to two decimals.

    Arrays & Hashingarraysdata-cleaningnan-handlingaggregation
  • Arrays & HashingMediumAuto-graded
    Bucket Words That Share the Same Letters

    Partition a list of lowercase words into buckets of mutual rearrangements, using a canonical key and a hash map while keeping a deterministic output order.

    Arrays & Hashinghash-mapstringssortinggrouping
  • Arrays & HashingMediumAuto-graded
    Event Log Selector with Window, Dedupe and Cap

    Filter a list of event records by type, time window and id, then order them stably by timestamp and truncate, testing careful handling of optional arguments and ties.

    Arrays & Hashinghashingstable-sortfilteringdedupe
  • Arrays & HashingMediumAuto-graded
    Circular Lamps with Traveling Togglers

    Find the final bits on a ring after several togglers walk clockwise for k steps, using lap decomposition, parity, and a cyclic difference array.

    Arrays & Hashingdifference-arraymodular-arithmeticparitysimulation-optimization
  • Arrays & HashingMediumAuto-graded
    Triple Challenge: Price Drops, Bounded Windows, Twin Rows

    Combine a threshold binary search with greedy arithmetic sums, a linear scan counting subarrays with exact min and max, and hashing of binary rows to count identical pairs.

    Arrays & Hashingbinary-searchgreedysliding-windowhashing
  • Arrays & HashingMediumAuto-graded
    Contiguous Smallest-Value Blocks in a Shuffled Sequence

    Given a permutation of 1..N, decide for each k whether the values 1..k occupy a contiguous block of positions, using a running min/max position sweep.

    Arrays & Hashingpermutationarrayssweepmin-max
  • Arrays & HashingMediumAuto-graded
    Enumerate All Index Pairs Adding Up to a Goal Value

    Tests hash-map indexing of duplicate values to list every index pair i < j whose values sum to a goal, in a specific sorted output order.

    Arrays & Hashinghash-maptwo-sumduplicatesenumeration
  • Arrays & HashingMediumAuto-graded
    Seven-Day Spend Grid per Shopper Using Only String Dates

    Aggregate (shopper, date, amount) records into per-shopper totals for a 7-day window, using hand-written ISO date stepping and hashing instead of date libraries.

    Arrays & Hashinghashingaggregationstring-datessimulation
  • Arrays & HashingEasyAuto-graded
    Compute Usage and Quality Metrics from Workplace Search Logs

    Aggregate a list of search log records into funnel, quality, latency and repeat-usage metrics, handling empty input and even-length medians.

    Arrays & Hashinghash-mapaggregationsimulationmedian
  • Arrays & HashingEasyAuto-graded
    95% Z-Interval for a Mean with Known Standard Deviation

    Compute a 95% z-based confidence interval for a population mean from a sample mean, known population standard deviation, and sample size, using the standard error.

    Arrays & Hashingconfidence-intervalcentral-limit-theoremstandard-errora-b-testing
  • Arrays & HashingMediumAuto-graded
    Group Paths Whose File Contents Match Exactly

    Group file paths whose contents are identical, using cheap filters like size and digest, with an exact comparison to confirm. Output is sorted groups of two or more paths.

    Arrays & Hashinghashinggroupingstringssorting
  • Arrays & HashingEasyAuto-graded
    Filter Names Absent From a Blocklist After Cleanup

    Return the items of one string list whose trimmed, lowercased form is missing from a second list, keeping original spelling, order, and duplicates; tests hash sets and normalization.

    Arrays & Hashinghash-setstringsnormalizationfiltering
  • Arrays & HashingMediumAuto-graded
    Longest Run Using Only Two Flavors

    Find the longest contiguous stretch of an integer array containing at most two distinct values, testing sliding window and frequency tracking.

    Arrays & Hashingsliding-windowtwo-pointershash-map
  • Arrays & HashingEasyAuto-graded
    Maximum Length of Identical Merged Arrays

    Find the maximum size of two matching arrays derived by repeatedly combining adjacent elements from two positive integer sequences, or return -1 if impossible.

    Arrays & Hashingarrayshash-tabletwo-pointersprefix-sum
  • Arrays & HashingEasyAuto-graded
    Build a Route Map Request with Markers and Striped Segments

    Convert longitude-first route points into a map request with start and end markers and path groups of ten segments that alternate colors and share boundary points.

    Arrays & Hashingarraysgroupingtransformationdictionaries