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.
137 easy303 medium37 hard
Showing 181–210 of 477 results
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.
Auto-gradedprefix-sumhash-mapsubarrayFind every possible smallest-missing value of an array after at most one capped +1 edit, using counting and MEX case analysis in linear time.
Auto-gradedmexcountingcase-analysisfrequency-arrayScan a 9x9 digit grid once and decide whether any row, column, or 3x3 block repeats a digit, using per-group bitmasks or sets.
Auto-gradedhashingbitmaskmatrixsimulationFind the largest k such that at least k scores are k or higher, using counting with capped values to reach linear time.
Auto-gradedcountingh-indexbucketarraysMatch reply events to earlier directed invites, normalize each user pair, and keep the earliest valid reply date per pair, sorted by pair.
Auto-gradedhash-mapgroupingdeduplicationdatesFind the two products that appear together in the most orders, handling duplicate lines, mirrored pairs, ties, and orders with fewer than two distinct products.
Auto-gradedhash-mapcombinationscountinggroupingA guide to solving four standard assessment tasks: cumulative running totals, step-by-step array reduction, deterministic matrix block placement, and linear arithmetic series optimization.
Model answerarrayssimulationgridoptimizationParse 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.
Auto-gradedhash-mapparsingsimulationroundingSliding-window distinct counting per group: find callers who reach at least five different receivers within any 7-day span of their call log.
Auto-gradedsliding-windowhash-mapgroupingtimestampsAggregate 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.
Auto-gradedhashingaggregationreconciliationdictionariesSimulate the concurrent step-by-step navigation of multiple automated grid rovers, handling collisions, static obstacles, and grid bounds.
Model answerarrayssimulationmatrixhash-tableCount how many booking records each vehicle has and return the ID with the highest count, breaking ties by the smallest ID.
Auto-gradedhash-mapcountingtie-breakingCompute 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.
Auto-gradedtwo-pointerssparse-vectorsorted-mergesimulationSimulate a custom board game involving stack placing and directed toppling moves to determine the game outcome.
Model answerarrayssimulationmatrixClean a noisy ranked result list (missing, duplicated, unknown, or oversized) and compute precision and recall against ground-truth labels.
Auto-gradedhashingsetsmetricsinput-validationGroup activity logs by user, dedupe dates, find maximal consecutive-day runs of length 7 or more, and report each user's earliest such run.
Auto-gradedhashingdatesgaps-and-islandssortingGroup booking records by user, find each canceller's earliest cancellation, and compute the percentage with no later confirmed or returned booking.
Auto-gradedhash-maptimestampsgroupingpercentageCount labels in every third slot of a flat list, find the second-highest distinct count, and break ties by earliest appearance.
Auto-gradedhash-mapcountingfrequencytie-breakingFind two different positions in an integer list whose values sum to a goal, using a deterministic tie-break rule, which tests complement lookup with a hash map.
Auto-gradedhash-maparraycomplement-lookuptwo-sumTests normalizing undirected pairs, filtering pending rows, and keeping the earliest date per pair from a list of event dictionaries, with deterministic sorted output.
Auto-gradedhash-mapgroupingnormalizationsortingParse cart records, total units and price in integer cents, apply the best percent-off or buy-N-get-M-free deal per product, then sort items by aisle with frozen goods at the end.
Model answerparsingmoney-arithmeticextensible-designsortingSimulate a year of account activity, applying a flat monthly charge unless a month has enough payments with a large enough total, and return the final balance.
Auto-gradedsimulationhash-mapaggregationconditional-logicRank five-card hands with a tuple key, then decide whether an outcome is forced across all ways to fill in missing cards.
Auto-gradedsimulationcombinatoricscountingtie-breakingCombines a binary search on a sorted list, adding one to a digit-array number with carry, and a stable in-place move of zeros to the back.
Auto-gradedbinary-searchtwo-pointerscarryin-placeGroup event logs by session, sort chronologically, count adjacent front-then-rear transitions, and average over all sessions, including sessions with zero flips.
Auto-gradedhash-mapgroupingsortingsimulationWrite a scorer that compares fields extracted from tax forms to a ground-truth mapping, normalizing keys and currency, then reporting match rate, missing and mismatched fields, and precision/recall.
Model answerdata-normalizationhash-mapsevaluation-metricsprecision-recallFind the earliest entry in a list of strings that occurs exactly once overall, or return an empty string, testing frequency counting combined with preserved order.
Auto-gradedhash-mapcountingstringstwo-passFind the single pair of distinct positions in an integer list whose values add up to a goal, using a one-pass lookup instead of checking every pair.
Auto-gradedhash-maparraycomplement-lookupTests group-then-broadcast logic: compute each group's mean over a list of dict records, then attach each row's difference from its group mean while preserving order.
Auto-gradedhash-mapgroup-byaggregationsimulationApply an ordered list of named filter rules to every user-event pair and build a per-user list of qualifying event ids, handling missing prices, empty rule lists and unknown rule names.
Auto-gradedhash-mapsimulationfilteringstrategy-pattern