KatInterview

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

Arrays & Hashing Interview Problems

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

5976
Problems
2213
Auto-graded
15
Topics
271
Added today

Showing 301–330 of 437 results

  • Arrays & HashingMediumAuto-graded
    Compute Spending Totals by Worker, Journey, and Type

    Tests efficient multi-key aggregation using hash maps to group and sum records in a single pass over large datasets.

    Arrays & Hashinghash-mapsaggregationgrouping
  • Arrays & HashingMediumAuto-graded
    Valid Subsets Bounded by Their Spread

    Count non-empty index-distinct subsets where the smallest plus largest value stays within a limit, using sorting, two pointers, and modular arithmetic.

    Arrays & Hashingtwo-pointerssortingcombinatorics
  • Arrays & HashingMediumAuto-graded
    Next Ace Probability Given at Least One Ace Already Drawn

    Tests conditional probability over sampling without replacement, combining hypergeometric counting with Bayes' theorem to handle a "at least one" conditioning event.

    Arrays & Hashingconditional-probabilitycombinatoricshypergeometric
  • Arrays & HashingMediumAuto-graded
    Slot-Aware Feed Deduplication Across Ordered Sections

    Tests whether candidates can implement a two-phase, cross-section deduplication policy with per-section slot limits, within-section uniqueness, and optional exempt sections.

    Arrays & Hashinghashingsimulationgreedy
  • Arrays & HashingMediumAuto-graded
    Three Probability Puzzles

    Tests understanding of optimal stopping, geometric probability, and Poisson processes through three independent probability calculations.

    Arrays & Hashingprobabilityoptimal-stoppingpoisson-processgeometric-probability
  • Arrays & HashingHardAuto-graded
    Peak Subarray Sum in a Run-Length-Encoded Sequence

    Tests whether a candidate can find the maximum sum of a fixed-length window over a run-length-encoded array too large to expand in memory.

    Arrays & Hashingsliding-windowprefix-sumsrun-length-encodingbinary-search
  • Arrays & HashingEasyAuto-graded
    Verify Which Orders Have Received Payments

    Given two unsorted lists of records linked by a shared booking_id, return a boolean per order indicating whether at least one matching payment exists.

    Arrays & Hashinghash-setlookupaggregation
  • Arrays & HashingHardAuto-graded
    Minimum Window Containing All K Most-Frequent Characters

    Tests ability to combine hash-counting (frequency maps) with a sliding window to find the shortest contiguous subarray satisfying a dynamic frequency-based constraint.

    Arrays & Hashingarrayshash mapsliding windowfrequency counting
  • Arrays & HashingMediumAuto-graded
    Contiguous Subarray with Sum Divisible by K

    Tests whether a candidate can apply prefix-sum modular arithmetic to detect a length-≥2 subarray whose sum divides evenly by k in linear time.

    Arrays & Hashingprefix-sumhash-mapmodular-arithmetic
  • Arrays & HashingMediumAuto-graded
    Probability the Third Card Is an Ace After an Ace Appears

    Compute a conditional probability for drawing three cards without replacement by splitting on how many aces the first two draws contain.

    Arrays & Hashingprobabilityconditional-probabilitycountingcombinatorics
  • Arrays & HashingMediumAuto-graded
    Clockwise Rotation with Frozen Diagonals

    Simulate clockwise 90° rotation on a square grid while keeping all main-diagonal and anti-diagonal elements fixed in place.

    Arrays & Hashingmatrixsimulationrotation
  • Arrays & HashingMediumAuto-graded
    Best Subarray Sum in a Tiled Sequence

    Tests whether a candidate can extend Kadane's algorithm to a sequence formed by repeating an array k times, handling boundary crossings and all-negative inputs.

    Arrays & Hashingkadanesubarraygreedy
  • Arrays & HashingMediumAuto-graded
    Best Sum of Extremes in a Contiguous Subarray

    Tests whether a candidate can reduce an O(n²) subarray search to a single linear scan by proving that adjacent pairs always dominate longer windows.

    Arrays & Hashingarraysgreedysliding-window
  • Arrays & HashingMediumAuto-graded
    Three Independent Array Challenges

    Tests greedy gain selection, modular triplet counting, and DP-based longest flexible non-decreasing subarray in one combined function.

    Arrays & Hashinggreedydynamic-programmingcombinatorics
  • Arrays & HashingMediumAuto-graded
    Largest Manhattan Distance of Aligned Subsequences

    Tests identifying that all-nonnegative distance terms let you reduce the search to complete diagonal overlaps, requiring quadratic iteration and overflow awareness.

    Arrays & Hashingarraystwo-pointersmathoptimization
  • Arrays & HashingMediumAuto-graded
    Longest All-Ones Window After Limited Bit Flips

    Tests the ability to reframe a flip problem as a sliding-window search and reason about amortized complexity.

    Arrays & Hashingsliding-windowtwo-pointersarrays
  • Arrays & HashingMediumAuto-graded
    R² Bounds When Two Predictors Are Combined in OLS

    Tests whether a candidate can derive the valid range of R² for a joint OLS model given the individual R² values of two single-predictor models.

    Arrays & HashingstatisticsregressionOLS
  • Arrays & HashingHardAuto-graded
    Cost-Aware Fraud Model Comparison

    Compares classification models using business costs, derives optimal decision thresholds, and identifies the most economical model.

    Arrays & Hashingclassificationcost-sensitive-learningconfusion-matrixmodel-evaluation
  • Arrays & HashingMediumAuto-graded
    Pair Indices with Given Sum

    Tests hash table usage and algorithm optimization to locate two array positions that sum to a target value.

    Arrays & Hashinghash-maptwo-pointersoptimization
  • Arrays & HashingMediumAuto-graded
    Filter Bank Transfers and Summarize by Source Account

    Tests ability to validate records against a lookup table, apply multi-condition filtering, and aggregate results into ranked frequency counts.

    Arrays & Hashingsimulationhash-mapsorting
  • Arrays & HashingMediumAuto-graded
    Text Spam Detector: Naive Bayes Classifier with F1 Score

    Tests understanding of probabilistic text classification by implementing a Multinomial Naive Bayes model from scratch and evaluating it with the F1 score.

    Arrays & Hashingnaive-bayestext-classificationf1-score
  • Arrays & HashingEasyAuto-graded
    Count Unique Elements in Array

    Identify how many values appear exactly one time in an integer array using frequency analysis.

    Arrays & Hashinghash-tablecountingfrequency-map
  • Arrays & HashingEasyAuto-graded
    Splice One Sequence Into Another by Index Range

    Tests careful list slicing and index boundary handling by replacing a contiguous subrange of one sequence with the full contents of a second sequence.

    Arrays & Hashingarraystwo-pointersimplementation
  • Arrays & HashingMediumAuto-graded
    Convolutional Layer Analysis: Shapes, Parameters, and Efficiency

    Calculate output dimensions, parameter counts, and multiply-accumulate operations for standard and depthwise separable convolutions.

    Arrays & Hashingconvolutional-networksparameter-countingcomputational-complexity
  • Arrays & HashingMediumAuto-graded
    Sorted Array: All Unique Pairs With a Given Sum

    Tests whether a candidate can apply the two-pointer pattern on a sorted array to collect every distinct value pair that adds up to a target, without emitting duplicates.

    Arrays & Hashingtwo-pointerssortingdeduplication
  • Arrays & HashingMediumAuto-graded
    Paginate and Budget-Trim a Chat History

    Assemble a chronological transcript from paginated data, then reduce it to fit a token limit by removing the earliest messages.

    Arrays & Hashingpaginationsliding-windowsimulation
  • Arrays & HashingMediumAuto-graded
    Rotate a Square Matrix 90° Clockwise In Place

    Tests whether a candidate can transform an n×n grid in place using transpose and row-reversal, with no extra matrix allocated.

    Arrays & Hashingmatrixin-placetwo-pointer
  • Arrays & HashingMediumAuto-graded
    Sample Size Calculator for Two-Proportion Z-Test

    Tests ability to implement statistical power calculations for comparing two binary outcome rates in experimental design.

    Arrays & Hashingexperimentationstatisticspower-analysis
  • Arrays & HashingMediumAuto-graded
    Rotation Distance: Sum Absolute Differences Across All Shifts

    Tests array rotation mechanics, computing position-wise absolute differences for every cyclic offset, and returning results in sorted order.

    Arrays & Hashingarraysrotationsorting
  • Arrays & HashingMediumAuto-graded
    Contiguous Subarray Sum Count

    Tests prefix sum technique with hash maps to count subarrays matching a target sum in linear time

    Arrays & Hashingprefix-sumhash-mapsubarray