KatInterview

Topic

Arrays & Hashing interview problems

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

Problems477

137 easy303 medium37 hard

Showing 301–330 of 477 results

  • Tests whether a candidate can scan an array in a single linear pass to find the length of the longest strictly increasing contiguous run.

    Auto-gradedarrayssliding-windowgreedy
  • Tests set-based membership filtering over a bounded integer range, with duplicate and out-of-bounds input handling.

    Auto-gradedsetsfilteringranges
  • Tests the ability to use prefix sums and a hash set to detect whether any contiguous slice of an array sums to a given value.

    Auto-gradedprefix-sumhash-setsubarray
  • Tests whether a candidate can slide a letter-template over an integer grid and detect every position where symbols and values form a valid one-to-one correspondence.

    Auto-gradedhash-mappattern-matchingmatrixisomorphism
  • Compute exact posterior probabilities over three weighted coins from a sequence of flips, plus the predictive probability the next flip is heads.

    Auto-gradedbayes-theoremprobabilityfractionsposterior-predictive
  • Determine which function name occurs most often in a list of log entries and report its occurrence count.

    Model answerhash-mapfrequency-countingiteration
  • Tests ability to implement a complete trading backtest with entry/exit logic, transaction costs, performance metrics, train/test splits, and statistical validation.

    Auto-gradedbacktestingtime-seriesfinancesimulation
  • Tests matrix manipulation, collision detection, and ordered simulation by placing fixed shapes onto a grid.

    Auto-gradedmatrixsimulationgreedy
  • Tests conditional probability under sampling without replacement from a fixed-composition deck given observed draw history.

    Auto-gradedprobabilitycombinatoricsconditional-probability
  • Solve three independent problems: tournament match counting, grid traversal with movement commands, and finding maximum sum of digit-disjoint pairs.

    Model answersimulationgraph-traversalbit-manipulationdfs
  • Tests probabilistic modeling with the Binomial distribution, Bayes' theorem, two-stage classification pipelines, and F1-optimal threshold selection in a risk-scoring context.

    Auto-gradedprobabilitybayes-theorembinomial-distribution
  • Tests whether a candidate can apply the variance-of-a-sum identity to extract correlation, and correctly handle the case where one variance is missing.

    Auto-gradedstatisticsmathprobability
  • Compute the binomial CDF: the chance that at most s of n independent customers request a limited item.

    Auto-gradedprobabilitybinomial-distributioncombinatoricscdf
  • Tests spatial hashing and set union logic to find customers whose required service tags are not collectively offered by any nearby vendor within a radius.

    Auto-gradedspatial-hashingset-operationsgrid-bucketing
  • Tests order-statistics reasoning for k-th missing positive integers and time-window frequency tracking to detect repeated log events.

    Auto-gradedarrayssortingsliding-window
  • Tests hash-based duplicate detection alongside a sliding window that finds the longest subarray containing exactly two distinct integer values.

    Auto-gradedsliding-windowhashingtwo-pointers
  • Apply many inclusive range additions over a possibly huge array and return the index holding the largest total, breaking ties toward the smallest index.

    Auto-gradeddifference-arrayprefix-suminterval-updatestie-break
  • Tests greedy assignment of ranks by processing elements in sorted order while maintaining row and column constraints.

    Auto-gradedsortinggreedymatrix
  • Tests boundary-tracking traversal under strict space and immutability constraints, requiring careful handling of single-row and single-column edge cases.

    Auto-gradedmatrixtraversalconstant-spaceboundary-tracking
  • Tests the ability to merge consecutive same-user image posts into gallery items and then apply a stable descending-timestamp sort to the resulting stream.

    Auto-gradedsimulationsortingtwo-pointers
  • Tests the ability to recognize when a running maximum equals the current index in a permutation, using invariant reasoning to avoid simulation.

    Auto-gradedpermutationsprefix-conditionrunning-maximuminvariants
  • Tests efficient two-pointer technique with sorted arrays, duplicate handling, and edge-case reasoning.

    Auto-gradedtwo-pointerssortingdeduplication
  • Tests sliding window technique on a circular binary array to find the maximum consecutive ones achievable by flipping at most one zero.

    Auto-gradedsliding-windowcircular-arraytwo-pointers
  • Tests sliding window technique for contiguous subarrays with constraints and binary search optimization for counting distinct values in sorted arrays.

    Auto-gradedsliding-windowbinary-searchtwo-pointeroptimization
  • Tests ability to use the two-pointer (sliding window) technique to find the longest contiguous subarray where the difference between the max and min elements stays within a given limit.

    Auto-gradedarraystwo pointerssliding window
  • Tests ability to combine prorated flat fees with two-tier volume pricing over a half-open time window.

    Auto-gradedsimulationmathaggregation
  • Tests ability to apply the two-sample normal approximation for A/B test sizing and convert a required sample count into a minimum experiment duration.

    Auto-gradedstatisticsexperimentationa-b-testing
  • Tests efficient 2-D prefix sweeps to compute each robot's nearest-wall distance in four directions and filter by an exact profile query.

    Auto-gradedmatrixprefix-scansimulation
  • Tests manual maximum-finding across a frequency dictionary, tie-breaking by first occurrence, and working with stringified keys.

    Auto-gradedhash-mapfrequency-countingiteration
  • Compute expected allocation count, reachability probability, and expected coverage when distributing items randomly with replacement.

    Auto-gradedprobabilityexpectationbinomialcomplement-rule

More topics