KatInterview

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

Arrays & Hashing Interview Problems

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

5972
Problems
2212
Auto-graded
15
Topics
273
Added today

Showing 121–150 of 476 results

  • Arrays & HashingMediumAuto-graded
    Collapse Rapid Cart Adds into Daily Pacific Action Counts

    Filter add-to-cart events, convert UTC to Pacific dates, merge rapid repeats into single actions with a chained gap rule, and count the actions per user, date and SKU.

    Arrays & Hashinghashinggroupingdatetimetimezones
  • Arrays & HashingMediumModel answer
    Best Single Trade Within a Limited Holding Period

    Find the most profitable buy-then-sell pair in a price array when the sale must happen within D days of the purchase, in O(n) time and O(1) extra space.

    Arrays & Hashingsliding-windowblock-decompositionmonotonic-dequestock-trading
  • Arrays & HashingEasyAuto-graded
    Find the Maximum Value in a Large Numerical Stream

    Find the maximum integer in a sequence while accounting for empty inputs and signed values.

    Arrays & Hashingarraysstreamingbasics
  • Arrays & HashingEasyAuto-graded
    Identify Redundant Files by Content Matching

    Cluster files that share identical byte contents by filtering first on file size metadata and then hashing content.

    Arrays & Hashingarrayshash mapstrings
  • Arrays & HashingMediumAuto-graded
    Peel a Grid Layer by Layer in a Clockwise Spiral

    Flatten a rectangular grid into a list by walking its perimeter clockwise inward, using shrinking boundaries and guards so single leftover rows or columns are not read twice.

    Arrays & Hashingmatrixsimulationtwo-pointersspiral
  • Arrays & HashingMediumAuto-graded
    Cohort Return Rates by Months Since First Visit

    Group users by the month of their first activity, then compute the fraction of each cohort that was active in every later month offset, using calendar-month arithmetic.

    Arrays & Hashinghash-mapgroupingdatescohort-analysis
  • Arrays & HashingMediumAuto-graded
    Apply a Single Capture Move on a Two-Colour Grid

    Apply one move on a grid: validate the target cell, find enclosed opponent runs in eight directions, and flip them together, or return the grid unchanged if no capture is possible.

    Arrays & Hashinggridsimulationmatrixdirections
  • Arrays & HashingEasyAuto-graded
    Weekly Trailing Mean Over a Daily Usage Series

    Compute the mean of every full block of seven consecutive readings in a list, returning an empty list when fewer than seven readings exist; tests sliding-window technique.

    Arrays & Hashingsliding-windowarraysprefix-sumsnumerics
  • Arrays & HashingEasyAuto-graded
    Order Each Neighboring Couple in a List, Skipping a Lone Tail

    Reorder the two values inside every consecutive couple of a list so the smaller comes first, keeping couples in place and leaving an unpaired final value alone.

    Arrays & Hashingarraystwo-pointerssimulationindex-handling
  • Arrays & HashingMediumAuto-graded
    2D Matrix Cross-Correlation Filter

    Compute the 2D cross-correlation between a grid matrix and a filter kernel using valid padding and stride 1.

    Arrays & Hashingarraysmatrix
  • Arrays & HashingEasyAuto-graded
    Binomial Process Modeling and Moment Computation

    Return theoretical properties and compute the expected value and variance for a Binomial random variable given sample size n and success probability p.

    Arrays & Hashingbinomialprobabilitystatisticsmath
  • Arrays & HashingMediumAuto-graded
    Most Common Values with First-Seen Tie-Breaking

    Return the k most frequent values in an integer list, ordered by count and then by first appearance, using hash counting and frequency buckets for linear time.

    Arrays & Hashinghash-mapbucket-sortfrequency-counttop-k
  • Arrays & HashingEasyAuto-graded
    Square Windows Containing Each Marked Cell

    Map each marked grid cell to the sorted top-left corners of all in-bounds 2x2 windows that contain it, testing coordinate arithmetic and bounds handling.

    Arrays & Hashinggridhash-mapcoordinatesenumeration
  • Arrays & HashingEasyAuto-graded
    Screening a Vendor Identity-Check Response

    Validate a nested vendor response with strict type checks, then apply ordered business rules to return the first failing reason code.

    Arrays & Hashingvalidationhash-maptype-checkingsimulation
  • Arrays & HashingMediumAuto-graded
    Next Lexicographic Ordering Plus Left-to-Right Calculator

    Rearrange an array in place into its next lexicographic ordering, and evaluate a parenthesis-free arithmetic string with truncating division, both in linear time.

    Arrays & Hashingnext-permutationtwo-pointersexpression-parsingin-place
  • Arrays & HashingMediumModel answer
    Code Review Drill: Three Pandas Helpers in a Data Pipeline

    Explain what three short pandas helper functions do, then propose and justify improvements to their correctness, speed, readability, robustness and testability.

    Arrays & Hashingpythonpandascode-reviewvectorization
  • Arrays & HashingEasyAuto-graded
    Dot Product of Two Run-Length Encoded Vectors

    Compute the dot product of two run-length encoded integer vectors by walking both run lists together, without expanding them into full arrays.

    Arrays & Hashingtwo-pointersrun-length-encodingsimulation
  • Arrays & HashingEasyAuto-graded
    Calculate Mean and Variance for the Sum of Two Variables

    Compute the expected value and total variance of the combined sum of two random variables given their individual means, variances, and covariance.

    Arrays & Hashingstatisticsprobabilitymath
  • Arrays & HashingMediumAuto-graded
    Resolve Callable Names from Argument Type Lists

    Match call argument types against registered signatures, some with a trailing repeatable parameter, and return the sorted names of every signature that fits each call.

    Arrays & Hashinghashingstringsvariadic-matchingprefix-keys
  • Arrays & HashingEasyAuto-graded
    Increment Large Integer Represented as Digits

    Process an array of decimal digits representing a non-negative integer by adding one, correctly handling carry propagation and list expansion.

    Arrays & Hashingarraysmath-bitseasy
  • Arrays & HashingEasyAuto-graded
    Activity Windows from Sensor Readings Over a Cutoff

    Scan sorted timestamped sensor readings once and group consecutive readings strictly above a cutoff into [first_time, last_time] windows.

    Arrays & Hashingarraystwo-pointersintervalssimulation
  • Arrays & HashingMediumAuto-graded
    Firebreak Choice in a Spreading Crop Disease Grid

    Simulate a synchronous grid disease model with delayed death or recovery, then try every single-row or single-column firebreak to minimize dead plants.

    Arrays & Hashingsimulationgridbrute-forcecellular-automaton
  • Arrays & HashingMediumAuto-graded
    Calculate Welch's T-Test P-Value for Experiment Rides

    Process user experiment assignments and ride telemetry data to calculate a Welch's two-sample t-test p-value under strict filtering rules.

    Arrays & Hashingstatisticsdata-processinghypothesis-testing
  • Arrays & HashingMediumAuto-graded
    Per-Unit Coupon Pricing with Half-Even Cent Rounding

    Total a shopping cart where each coupon discounts one unit of its item, with percent discounts rounded half-to-even in exact integer arithmetic.

    Arrays & Hashinghash-mapsimulationroundinginteger-math
  • Arrays & HashingEasyAuto-graded
    Compute Post-Match Standardized Mean Differences

    Evaluate post-matching covariate balance by computing the absolute standardized mean difference across features.

    Arrays & Hashingstatisticsmath-bitsarrays
  • Arrays & HashingEasyAuto-graded
    Rollout Impact: Diff-in-Diff Estimate with Baseline Drift Check

    Aggregate per-group, per-window means from daily records, compute a difference-in-differences estimate, and flag baseline drift between two pre-period sub-windows.

    Arrays & Hashinghashingaggregationstatisticsdate-windows
  • Arrays & HashingEasyAuto-graded
    Generate Cartesian Product of Search Space Parameters

    Construct all explicit configurations from a dictionary mapping parameter names to lists of candidate values using Cartesian product generation.

    Arrays & Hashingcartesian-productgeneratorarraysdictionary-manipulation
  • Arrays & HashingMediumAuto-graded
    Find Most Overlapping Pair of Sets

    Find the pair of set keys with the highest intersection size, using Jaccard similarity and lexicographical order as tie-breakers via an inverted index approach.

    Arrays & Hashinginverted-indexhash-tablearraysstring
  • Arrays & HashingMediumAuto-graded
    Grid Editor: Flip Rows, Swap Rows, and Turn Clockwise

    Simulate a sequence of string commands (row reversal, row swap, 90-degree clockwise turn) on a rectangular grid whose shape changes after each turn.

    Arrays & Hashingmatrixsimulationstring-parsingrotation
  • Arrays & HashingMediumAuto-graded
    Product of Two Mostly-Zero Grids

    Compute the product of two mostly-zero integer matrices by precomputing nonzero positions so that no work is spent on zero operands.

    Arrays & Hashingmatrixsparsesimulationhashing