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 151–180 of 437 results

  • Arrays & HashingMediumAuto-graded
    Fit a Line by Full-Batch Gradient Descent on Squared Error

    Implement full-batch gradient descent for a one-feature linear model, using gradients from the old parameters at every step to update the slope and intercept together.

    Arrays & Hashinggradient-descentlinear-regressionnumericalsimulation
  • Arrays & HashingEasyAuto-graded
    Static Array Range Sum Queries

    Process a sequence of range sum queries on an immutable array efficiently using prefix sums.

    Arrays & Hashingarraysprefix-sumdata-structures
  • Arrays & HashingMediumAuto-graded
    Survey Click-Through and Score Averages from Impression Logs

    Group survey impression records to compute a click rate, a plain score average, and an average of each user's earliest score per survey, with careful handling of missing values.

    Arrays & Hashinghash-mapgroupingsortingnull-handling
  • Arrays & HashingMediumAuto-graded
    Can Your Unfinished Poker Hand Overtake a Showdown Hand?

    Decide whether a 3 or 4 card poker hand can be filled from the unseen deck into a five-card hand that strictly outranks a revealed five-card hand.

    Arrays & Hashingsimulationbrute-forcecombinationspoker
  • Arrays & HashingEasyAuto-graded
    Simulate Slice Appending in Go

    Simulate how slicing and slice appending mutate backing arrays and slice headers in Go.

    Arrays & Hashingarrayssimulation
  • Arrays & HashingEasyAuto-graded
    Target Token Loss and Exponential Uncertainty Score

    Compute the mean negative log-likelihood across target tokens and convert it into perplexity for a given logarithm base.

    Arrays & Hashingmachine-learningmathnlp
  • Arrays & HashingEasyAuto-graded
    Bayesian Origin Probability for Sampled Items

    Calculate the posterior probability that two black items came from a specific facility using Bayes' Theorem.

    Arrays & Hashingstatisticsprobabilitybayes-theorem
  • Arrays & HashingEasyAuto-graded
    Overlap Ratio of Two Token Lists

    Compute the overlap ratio between the distinct strings of two lists using hash sets, with exact string matching and a defined result when both lists are empty.

    Arrays & Hashinghash-setsetsstringsedge-cases
  • Arrays & HashingMediumAuto-graded
    Most Popular Three-Page Browsing Path Across Users

    Group visit logs by user, order them by time, and find the three-page ordered path shared by the most distinct users, with a lexicographic tie-break.

    Arrays & Hashinghashingsortingcombinationscounting
  • Arrays & HashingHardAuto-graded
    Calculate Expected Roll Counts for Target Dice Sequences

    Evaluate expected values for geometric process waiting times and pattern completion using Markov chain state transitions.

    Arrays & Hashingprobabilityexpected-valuemarkov-chainscombinatorics
  • Arrays & HashingEasyAuto-graded
    Find Minimum and Mode of an Integer Array

    Find the minimum element and the most frequent element (mode) in an unsorted list of integers.

    Arrays & Hashingarrayshash-tablefrequency-counting
  • Arrays & HashingEasyAuto-graded
    Reverse Array Segment Between First Two Target Occurrences

    Reverse the subsegment of an array from the first occurrence of a target value up to its second occurrence.

    Arrays & Hashingarraystwo-pointersslicing
  • Arrays & HashingMediumAuto-graded
    Runners on a Road Frozen by a Sweeping Guard

    Simulate runners advancing along a road while a guard turns at given seconds and freezes anyone in view, using parity of duplicate turn times and strict event ordering.

    Arrays & Hashingsimulationhash-mapcountingparity
  • Arrays & HashingEasyAuto-graded
    Push Zeros Left While Keeping Other Values in Order

    Rearrange an integer list in place so all zeros come first and the non-zero values keep their original relative order, using a right-to-left two-pointer pass.

    Arrays & Hashingarraystwo-pointersin-place
  • Arrays & HashingMediumAuto-graded
    Four-Position Target Sum Finder Preserving Original Indices

    Find all increasing index quadruples whose values add up to a target, treating equal values at different positions as distinct answers; tests hashing pair sums and ordering.

    Arrays & Hashinghash-mapmeet-in-the-middlek-sumindices
  • Arrays & HashingEasyAuto-graded
    Softmax-Weighted Value Mixing for Query Rows

    Implement scaled dot-product attention on nested lists using a numerically stable softmax and a weighted average of value rows.

    Arrays & Hashingmatrixsoftmaxnumerical-stabilityattention
  • Arrays & HashingEasyAuto-graded
    Find the Modal Number, Smallest on a Tie

    Tests frequency counting with a hash map and a deterministic numeric tie-break, returning the value itself without altering the input list.

    Arrays & Hashinghash-mapcountingtie-breaking
  • Arrays & HashingMediumAuto-graded
    Merge Sensor Readings into Qualifying State Runs

    Group consecutive identical-state readings into runs, then keep only runs whose last-minus-first timestamp span meets a minimum threshold.

    Arrays & Hashingrun-lengthsingle-passsimulationgrouping
  • Arrays & HashingMediumAuto-graded
    Widest Window With an Exact Total in a Signed Sequence

    Find the longest contiguous run in an integer list (negatives and zeros allowed) whose total equals a target, using prefix sums and a hash map of earliest positions.

    Arrays & Hashingprefix-sumhash-mapsubarray
  • Arrays & HashingHardAuto-graded
    Reachable Smallest Missing Values After a Single Increment

    Find every possible smallest-missing value of an array after at most one capped +1 edit, using counting and MEX case analysis in linear time.

    Arrays & Hashingmexcountingcase-analysisfrequency-array
  • Arrays & HashingMediumAuto-graded
    Check a Partially Filled Number Grid for Rule Violations

    Scan a 9x9 digit grid once and decide whether any row, column, or 3x3 block repeats a digit, using per-group bitmasks or sets.

    Arrays & Hashinghashingbitmaskmatrixsimulation
  • Arrays & HashingMediumAuto-graded
    Maximum Score Level Backed by Enough Servers

    Find the largest k such that at least k scores are k or higher, using counting with capped values to reach linear time.

    Arrays & Hashingcountingh-indexbucketarrays
  • Arrays & HashingMediumAuto-graded
    Confirmed Connections from Invites and Replies

    Match reply events to earlier directed invites, normalize each user pair, and keep the earliest valid reply date per pair, sorted by pair.

    Arrays & Hashinghash-mapgroupingdeduplicationdates
  • Arrays & HashingMediumAuto-graded
    Most Common Item Pair Across Shopping Baskets

    Find the two products that appear together in the most orders, handling duplicate lines, mirrored pairs, ties, and orders with fewer than two distinct products.

    Arrays & Hashinghash-mapcombinationscountinggrouping
  • Arrays & HashingMediumAuto-graded
    Price Card Payments with Tiered Rates and Running Merchant Totals

    Parse comma-separated payment rows, build a per-row rate from several rules plus a per-merchant running total, and round fees exactly to whole cents.

    Arrays & Hashinghash-mapparsingsimulationrounding
  • Arrays & HashingMediumAuto-graded
    Find Accounts With Five Distinct Contacts in a Week

    Sliding-window distinct counting per group: find callers who reach at least five different receivers within any 7-day span of their call log.

    Arrays & Hashingsliding-windowhash-mapgroupingtimestamps
  • Arrays & HashingMediumAuto-graded
    Audit Purchase Events Against a Payment Ledger

    Aggregate daily purchase metrics from event logs and reconcile two event snapshots against a ledger to judge whether a tracking fix worked, using hash-map grouping.

    Arrays & Hashinghashingaggregationreconciliationdictionaries
  • Arrays & HashingEasyAuto-graded
    Most Frequently Booked Vehicle

    Count how many booking records each vehicle has and return the ID with the highest count, breaking ties by the smallest ID.

    Arrays & Hashinghash-mapcountingtie-breaking
  • Arrays & HashingMediumAuto-graded
    Inner Product of Two Index-Value Lists

    Compute the inner product of two sparse vectors given as sorted index-value pairs by intersecting their indices with a linear merge, without building dense arrays.

    Arrays & Hashingtwo-pointerssparse-vectorsorted-mergesimulation
  • Arrays & HashingEasyAuto-graded
    Score a Top-k Search Result Against Labeled Files

    Clean a noisy ranked result list (missing, duplicated, unknown, or oversized) and compute precision and recall against ground-truth labels.

    Arrays & Hashinghashingsetsmetricsinput-validation