KatInterview

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

Arrays & Hashing Interview Problems

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

5978
Problems
2214
Auto-graded
15
Topics
272
Added today

Showing 181–210 of 477 results

  • Arrays & HashingMediumAuto-graded
    Widest Window With an Exact Total in a Signed Sequence

    Find the longest contiguous run in an integer list (negatives and zeros allowed) whose total equals a target, using prefix sums and a hash map of earliest positions.

    Arrays & Hashingprefix-sumhash-mapsubarray
  • Arrays & HashingHardAuto-graded
    Reachable Smallest Missing Values After a Single Increment

    Find every possible smallest-missing value of an array after at most one capped +1 edit, using counting and MEX case analysis in linear time.

    Arrays & Hashingmexcountingcase-analysisfrequency-array
  • Arrays & HashingMediumAuto-graded
    Check a Partially Filled Number Grid for Rule Violations

    Scan a 9x9 digit grid once and decide whether any row, column, or 3x3 block repeats a digit, using per-group bitmasks or sets.

    Arrays & Hashinghashingbitmaskmatrixsimulation
  • Arrays & HashingMediumAuto-graded
    Maximum Score Level Backed by Enough Servers

    Find the largest k such that at least k scores are k or higher, using counting with capped values to reach linear time.

    Arrays & Hashingcountingh-indexbucketarrays
  • Arrays & HashingMediumAuto-graded
    Confirmed Connections from Invites and Replies

    Match reply events to earlier directed invites, normalize each user pair, and keep the earliest valid reply date per pair, sorted by pair.

    Arrays & Hashinghash-mapgroupingdeduplicationdates
  • Arrays & HashingMediumAuto-graded
    Most Common Item Pair Across Shopping Baskets

    Find the two products that appear together in the most orders, handling duplicate lines, mirrored pairs, ties, and orders with fewer than two distinct products.

    Arrays & Hashinghash-mapcombinationscountinggrouping
  • Arrays & HashingMediumModel answer
    Solving Multi-Task Online Assessment Challenges

    A guide to solving four standard assessment tasks: cumulative running totals, step-by-step array reduction, deterministic matrix block placement, and linear arithmetic series optimization.

    Arrays & Hashingarrayssimulationgridoptimization
  • Arrays & HashingMediumAuto-graded
    Price Card Payments with Tiered Rates and Running Merchant Totals

    Parse comma-separated payment rows, build a per-row rate from several rules plus a per-merchant running total, and round fees exactly to whole cents.

    Arrays & Hashinghash-mapparsingsimulationrounding
  • Arrays & HashingMediumAuto-graded
    Find Accounts With Five Distinct Contacts in a Week

    Sliding-window distinct counting per group: find callers who reach at least five different receivers within any 7-day span of their call log.

    Arrays & Hashingsliding-windowhash-mapgroupingtimestamps
  • Arrays & HashingMediumAuto-graded
    Audit Purchase Events Against a Payment Ledger

    Aggregate daily purchase metrics from event logs and reconcile two event snapshots against a ledger to judge whether a tracking fix worked, using hash-map grouping.

    Arrays & Hashinghashingaggregationreconciliationdictionaries
  • Arrays & HashingMediumModel answer
    Simulate Grid Rover Fleet Collision Logic

    Simulate the concurrent step-by-step navigation of multiple automated grid rovers, handling collisions, static obstacles, and grid bounds.

    Arrays & Hashingarrayssimulationmatrixhash-table
  • Arrays & HashingEasyAuto-graded
    Most Frequently Booked Vehicle

    Count how many booking records each vehicle has and return the ID with the highest count, breaking ties by the smallest ID.

    Arrays & Hashinghash-mapcountingtie-breaking
  • Arrays & HashingMediumAuto-graded
    Inner Product of Two Index-Value Lists

    Compute the inner product of two sparse vectors given as sorted index-value pairs by intersecting their indices with a linear merge, without building dense arrays.

    Arrays & Hashingtwo-pointerssparse-vectorsorted-mergesimulation
  • Arrays & HashingMediumModel answer
    Simulate Cascade Board Game Outcome

    Simulate a custom board game involving stack placing and directed toppling moves to determine the game outcome.

    Arrays & Hashingarrayssimulationmatrix
  • Arrays & HashingEasyAuto-graded
    Score a Top-k Search Result Against Labeled Files

    Clean a noisy ranked result list (missing, duplicated, unknown, or oversized) and compute precision and recall against ground-truth labels.

    Arrays & Hashinghashingsetsmetricsinput-validation
  • 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 & HashingMediumModel answer
    Cart Pricing Engine: Offers, Cheapest Deal, Aisle Sort

    Parse cart records, total units and price in integer cents, apply the best percent-off or buy-N-get-M-free deal per product, then sort items by aisle with frozen goods at the end.

    Arrays & Hashingparsingmoney-arithmeticextensible-designsorting
  • 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 & HashingMediumModel answer
    Scoring Parsed Payroll Form Output Against Ground Truth

    Write a scorer that compares fields extracted from tax forms to a ground-truth mapping, normalizing keys and currency, then reporting match rate, missing and mismatched fields, and precision/recall.

    Arrays & Hashingdata-normalizationhash-mapsevaluation-metricsprecision-recall
  • 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