KatInterview

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

Arrays & Hashing Interview Problems

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

5973
Problems
2212
Auto-graded
15
Topics
271
Added today

Showing 331–360 of 436 results

  • Arrays & HashingMediumAuto-graded
    Minimum Operations to Equalize Array by Selective Increments

    Tests insight that incrementing all-but-one is equivalent to decrementing one, leading to a sum-based formula instead of simulation.

    Arrays & Hashingmatharraysgreedy
  • Arrays & HashingEasyAuto-graded
    Best-of-Five: Probability All Five Games Are Played

    Tests whether a candidate can derive the closed-form probability that a best-of-five series requires all five games, using combinatorial reasoning.

    Arrays & Hashingprobabilitycombinatoricsmath
  • Arrays & HashingEasyAuto-graded
    Expected Coin Flips to Observe Heads Then Tails

    Tests ability to model a probabilistic process with states and solve expectation equations.

    Arrays & Hashingprobabilityexpected-valuemarkov-chains
  • Arrays & HashingMediumAuto-graded
    Sample Mean: Expected Value and Variance Under Correlation

    Tests ability to compute the expected value and variance of a sample mean when observations share a common correlation, plus limiting behavior in boundary cases.

    Arrays & Hashingstatisticsprobabilityexpected-valuevariance
  • Arrays & HashingHardAuto-graded
    Find All Contiguous Segments with Target Total

    Tests prefix sum tracking with hash maps to efficiently count all contiguous subsequences that sum to a target value.

    Arrays & Hashingprefix-sumhash-maparray
  • Arrays & HashingEasyAuto-graded
    Daily-Deal Voucher: Restaurant Profit & Break-Even Analysis

    Tests whether you can build a contribution-margin model for a voucher partnership, solve break-even and sensitivity equations, and decompose a profit change into its drivers.

    Arrays & Hashingunit economicscontribution marginbreak-even analysis
  • Arrays & HashingEasyAuto-graded
    Tight Probability Bounds for the Union of Two Events

    Tests whether a candidate can derive the Fréchet bounds on P(A ∪ B) given only the marginal probabilities of two events with unspecified dependence.

    Arrays & Hashingprobabilityboundsinclusion-exclusion
  • Arrays & HashingEasyAuto-graded
    Mean Distinct Item Count Per Group

    Tests ability to deduplicate items within groups, handle null values, and compute aggregated metrics with proper rounding.

    Arrays & Hashinghash-mapsetaggregationdata-processing
  • Arrays & HashingMediumAuto-graded
    Seven-Segment Display 180° Rotation Symmetry

    Determine if a sequence of seven-segment digits appears identical when the entire display is flipped upside down.

    Arrays & Hashingarrayssimulationmapping
  • Arrays & HashingMediumAuto-graded
    Group and Rank Users by Average Value

    Tests efficient grouping and aggregation over dictionaries, plus multi-key sorting to produce ordered output.

    Arrays & Hashingaggregationdictionariessorting
  • Arrays & HashingEasyAuto-graded
    Filter and Sort Items by Embedding Similarity Score

    Tests vector scoring with dot products, stable sorting with tie-breaking, and set-based filtering of excluded indices.

    Arrays & Hashingarrayssortingfiltering
  • Arrays & HashingMediumAuto-graded
    Suffix Maximum Frequency Count

    Computes how many times the largest element appears in each suffix of an array using a single backward scan.

    Arrays & Hashingarrayssuffix-queriessingle-pass
  • Arrays & HashingEasyAuto-graded
    Rank Nearest Neighbors by Mean Squared Error

    Tests k-nearest neighbors search with distance computation, NULL handling, and top-k selection with tie-breaking.

    Arrays & Hashingsimilaritydistance-metricsrankingdata-processing
  • Arrays & HashingMediumAuto-graded
    Zero-Sum Triplets in an Array

    Tests two-pointer technique on sorted arrays, duplicate avoidance, and quadratic complexity optimization for finding triplet combinations.

    Arrays & Hashingtwo-pointerssortingarray-traversal
  • Arrays & HashingMediumAuto-graded
    Sliding Window Average over an Integer Sequence

    Tests whether a candidate can compute consecutive fixed-width window averages in O(n) time by maintaining a running sum instead of recomputing each window from scratch.

    Arrays & Hashingsliding-windowarraystwo-pointers
  • Arrays & HashingMediumAuto-graded
    Collect Characters by Walking a Grid

    Tests grid traversal with directional commands, run-length encoding, and boundary/obstacle validation.

    Arrays & Hashingmatrixsimulationstring-building
  • Arrays & HashingMediumAuto-graded
    Reorganize Array Elements by Hash-Based Bucket Assignment

    Tests understanding of parallel counting, prefix sums, and scatter operations to group array elements into contiguous buckets.

    Arrays & Hashingcountingprefix-sumpartitioning
  • Arrays & HashingMediumAuto-graded
    Difference in Proportions Confidence Interval

    Tests understanding of statistical inference by computing a confidence interval for the difference between two independent proportions.

    Arrays & Hashingstatisticshypothesis-testingconfidence-intervalsexperimental-design
  • Arrays & HashingMediumAuto-graded
    Repair a Looping Script by Swapping One Instruction

    Tests simulation, cycle detection, and brute-force search by finding the single jmp/nop swap that lets a small virtual machine terminate cleanly.

    Arrays & Hashingsimulationcycle-detectionbrute-force
  • Arrays & HashingEasyAuto-graded
    Classify Temperatures into Three Weather Bands

    Tests careful boundary handling by bucketing integer temperatures into cold, mild, and hot ranges and returning the three counts in order.

    Arrays & Hashingarrayscountingboundary conditions
  • Arrays & HashingMediumAuto-graded
    Rectangular Stamp Overlap Counter

    Tests whether a candidate can use a 2D difference array to efficiently count how many rectangular regions overlap each cell of a grid.

    Arrays & Hashing2d-arrayprefix-sumdifference-array
  • Arrays & HashingEasyAuto-graded
    Find Days Available to All Participants

    Tests set intersection logic and handling of multiple collections to find common elements across all inputs.

    Arrays & Hashingsetsintersectionarrays
  • Arrays & HashingMediumAuto-graded
    Puddles in a Valley: Water Volume Between Terrain Columns

    Tests whether a candidate can compute trapped water volume across a height profile using the two-pointer O(1)-space technique.

    Arrays & Hashingtwo-pointersprefix-maxarrays
  • Arrays & HashingHardAuto-graded
    Distinct Value Sum Across Peak-Score Square Ring Windows

    Tests 2D prefix sums, border enumeration, multi-way tie tracking, and cross-frame value deduplication on square ring-shaped windows of a matrix.

    Arrays & Hashing2d-prefix-summatrixsliding-window
  • Arrays & HashingMediumAuto-graded
    Best Single-Breakpoint Step-Function Fit

    Tests whether a candidate can derive an O(n) prefix-aggregate sweep to find the one split index that minimizes total squared error for a two-segment constant model.

    Arrays & Hashingarraysmathprefix-sums
  • Arrays & HashingMediumAuto-graded
    Aggregate Tournament Standings from User Rankings

    Tests pairwise comparison aggregation, majority voting with tie-breaking, and ranking by win totals.

    Arrays & Hashingarrayssortingaggregation
  • Arrays & HashingEasyAuto-graded
    Neural Network Implementation of Centroid-Based Classification

    Derives the weight matrix and bias vector of a single-layer network that performs soft assignment to cluster centers using squared distance.

    Arrays & Hashingneural-networksclusteringlinear-algebra
  • Arrays & HashingMediumAuto-graded
    Filter Devices by Status, Threshold, and Registration Month

    Tests nested JSON navigation, timestamp parsing in UTC, date-range filtering, and numeric comparison with multiple simultaneous predicates.

    Arrays & Hashingjsondatetimefilteringdata-processing
  • Arrays & HashingMediumAuto-graded
    Shortest Subarray With All K Distinct Characters Present

    Tests ability to use a sliding window with a hash-count map to find the minimum-length contiguous subarray that contains every distinct character appearing in a string at least a given number of times.

    Arrays & Hashingarrayshash mapsliding window
  • Arrays & HashingHardAuto-graded
    Computing Equilibrium Bids in Single-Item Auctions

    Tests understanding of dominant strategy equilibria in second-price auctions and Bayesian Nash equilibria in first-price auctions with uniform value distributions.

    Arrays & Hashinggame-theoryauction-theoryexpected-valuebayesian-equilibrium