KatInterview

Topic

Arrays & Hashing interview problems

Two pointers, prefix sums, hash maps and sliding windows. 476 original problems, each with hidden test cases you can run in the browser.

Problems476

136 easy303 medium37 hard

Showing 331–360 of 476 results

  • Tests dictionary grouping, set operations on list suffixes, and canonical key construction for equivalence classes.

    Auto-gradedhash-mapset-operationsgrouping
  • Tests discrete-time physics simulation with kinematic updates and safety constraint checking across multiple moving objects.

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

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

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

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

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

    Auto-gradedprobabilityoptimal-stoppingpoisson-processgeometric-probability
  • 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.

    Auto-gradedsliding-windowprefix-sumsrun-length-encodingbinary-search
  • 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.

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

    Auto-gradedarrayshash mapsliding windowfrequency counting
  • 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.

    Auto-gradedprefix-sumhash-mapmodular-arithmetic
  • Implement the slide-and-merge move for a 2048-style grid in all four directions, sharing a single merge routine across every direction.

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

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

    Auto-gradedmatrixsimulationrotation
  • 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.

    Auto-gradedkadanesubarraygreedy
  • 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.

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

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

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

    Auto-gradedsliding-windowtwo-pointersarrays
  • 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.

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

    Auto-gradedclassificationcost-sensitive-learningconfusion-matrixmodel-evaluation
  • Tests hash table usage and algorithm optimization to locate two array positions that sum to a target value.

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

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

    Auto-gradednaive-bayestext-classificationf1-score
  • Identify how many values appear exactly one time in an integer array using frequency analysis.

    Auto-gradedhash-tablecountingfrequency-map
  • Tests careful list slicing and index boundary handling by replacing a contiguous subrange of one sequence with the full contents of a second sequence.

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

    Auto-gradedconvolutional-networksparameter-countingcomputational-complexity
  • 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.

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

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

    Auto-gradedmatrixin-placetwo-pointer

More topics