practice a little every day — you've got this ♡
Arrays & Hashing Interview Problems
Practice 5971 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.
- 5971
- Problems
- 2211
- Auto-graded
- 15
- Topics
- 272
- Added today
Showing 91–120 of 475 results
- Arrays & HashingMediumAuto-gradedLongest Run of Non-Repeating Numbers in an Array
Find the length of the longest contiguous stretch of an integer array in which no value appears twice, using a sliding window with a last-seen index map.
Arrays & Hashingsliding-windowhash-maptwo-pointerssubarray - Arrays & HashingMediumModel answerFix a Failing Budget-Check Module and Add Regression Tests
Debug a small spending-limit module with failing tests: find root causes, fix them, add minimal regression tests, and explain your debugging process and tools.
Arrays & Hashingdebuggingunit-testingroot-cause-analysisfloating-point - Arrays & HashingMediumAuto-gradedMatch Cells by Four-Way Gap to Nearest Blocker
Compute, for every empty cell, the gap to the nearest blocker in each of four directions using linear sweeps, then return the cells whose four gaps equal a given target.
Arrays & Hashinggridmatrixprefix-sweepsimulation - Arrays & HashingMediumAuto-gradedAssign Persistent Table Column Identifiers
Process sequential database schema snapshots to assign permanent, case-insensitive unique column aliases with automatic collision resolution.
Arrays & Hashingarraysstringsdesign-ds - Arrays & HashingEasyAuto-gradedKeep First Record Per Login ID in Linear Time
Filter a list of record dictionaries so only the first record for each identifier remains, preserving order and doing it in a single linear pass with a hash set.
Arrays & Hashinghash-setdeduplicationarraysorder-preservation - Arrays & HashingMediumAuto-gradedFind Unique Integer Triplets Summing to Target
Finds all unique value triplets in an integer array that sum to a specified target using sorting, two-pointer scanning, and pruning.
Arrays & Hashingarraystwo-pointerssortingdeduplication - Arrays & HashingEasyAuto-gradedFind All Top-Frequency Labels Without Using max()
Count items by their string form and return every label tied for the highest count, in first-appearance order, without calling max().
Arrays & Hashinghash-mapcountingfrequencyties - Arrays & HashingMediumAuto-gradedPossible Minimum Excluded Values After One Increment
Find all possible values of the minimum non-negative excluded integer (MEX) achievable after at most one element increment.
Arrays & Hashingarrayshash-tablefrequency-arraymath - Arrays & HashingMediumModel answerDistance-to-Go Along Batched 2D Routes
Given a batch of 2D routes, compute for each waypoint the length of the remaining route to the final waypoint, in linear time, handling short and empty inputs.
Arrays & Hashingsuffix-sumnumpyvectorizationeuclidean-distance - Arrays & HashingMediumAuto-gradedWaiting-Time Triangle Density: Normalize and Evaluate the CDF
Normalize a piecewise-linear triangular density to find its constant, then evaluate the resulting piecewise-quadratic cumulative distribution at a list of query points.
Arrays & Hashingprobabilitycdfpiecewise-functionsintegration - Arrays & HashingEasyAuto-gradedRepair a Sensor Log: Merge, Sort, and Interpolate Gaps
Merge duplicate timestamps by averaging known readings, sort, then fill missing values by linear interpolation inside gaps and nearest-value holding at the ends.
Arrays & Hashinghash-mapsortinginterpolationtime-series - Arrays & HashingEasyAuto-gradedPair Sum Existence Check in an Integer List
Decide whether any two elements at different positions in an integer list add up to a given value, testing hash-set lookups and careful handling of duplicates.
Arrays & Hashinghash-settwo-sumarrayscomplement - Arrays & HashingMediumAuto-gradedPrefix Value Blocks in a Shuffled Sequence
Decide, for every k, whether the values 1..k occupy a contiguous block of a permutation, using value positions and a running span instead of scanning subarrays.
Arrays & Hashingpermutationindex-mappingrunning-min-maxstring-output - Arrays & HashingMediumAuto-gradedQuarter-Turn a Square Grid of Pixels Without Extra Storage
Turn a square integer grid a quarter turn clockwise by modifying it in place, testing index mapping and in-place transforms such as transpose plus row reversal.
Arrays & Hashingmatrixin-placesimulationtranspose - Arrays & HashingEasyAuto-gradedFind Lowest Cost Ticket Pair Across Consecutive Days
Find the minimum combined cost of an outbound and return ticket where return happens strictly after departure.
Arrays & Hashingarraysgreedyprefix-minimum - Arrays & HashingMediumAuto-gradedUsers Active for a Week Straight: Detect 7-Day Streaks in Event Logs
Find users whose event log contains at least seven consecutive UTC calendar days of activity, using per-user day deduplication and a sorted streak scan.
Arrays & Hashinghashingdatesstreakssorting - Arrays & HashingEasyAuto-gradedCalculate Maximum Single-Trade Return
Find the maximum non-negative profit from purchasing an asset on one day and selling it on a subsequent day.
Arrays & Hashingarraysdynamic-programminggreedy-intervals - Arrays & HashingEasyAuto-gradedCross-Tabulate Records by Composite Row and Column Keys
Group records by composite row and column keys, sum a value field per pair, and return the axes in first-seen order with a dense grid that has zeros for missing pairs.
Arrays & Hashinghash-mapgroupingaggregationtuples - Arrays & HashingMediumAuto-gradedGravity Grid: Pushing Tokens Up from Below and Spotting Matching Lines
Simulate a grid where tokens are pushed in from the bottom of a column, and after each push report success and whether any full column or full row is single-typed.
Arrays & Hashingsimulationmatrixstate-trackinggrid - Arrays & HashingEasyAuto-gradedCheck Loan Records for Proper Borrow-Return Order
Scan a time-ordered list of library events and verify each item's history strictly alternates borrow, return, starting with a borrow, using per-item state tracking.
Arrays & Hashinghash-setstate-trackingsimulationvalidation - Arrays & HashingEasyAuto-gradedSmallest Axis-Aligned Box Around Scattered Points
Scan a list of integer 2D points once to find the extreme x and y values, then report the enclosing axis-aligned box as a corner plus width and height.
Arrays & Hashingarraysgeometrymin-maxsingle-pass - Arrays & HashingEasyAuto-gradedCalculate Spend Percentage of High-Volume Spenders
Compute the share of 2023 total expenditure contributed by users who met a high-tier spending threshold in 2022.
Arrays & Hashingarrayshash tabledata manipulationcohort analysis - Arrays & HashingEasyAuto-gradedUncovered Integer Gaps Within a Closed Window
Scan a sorted list of distinct integers once to report every maximal run of integers in a closed window that the list skips, formatting single gaps as one-element lists.
Arrays & Hashingarraysintervalstwo-pointersedge-cases - Arrays & HashingMediumAuto-gradedValidate a Shuffled Start/Stop Service Log for Each Component
Replay timestamped start/stop events in time order, with ties broken by input position, tracking one active job per category, and confirm the log is valid and fully closed.
Arrays & Hashinghash-setsortingsimulationstate-tracking - Arrays & HashingMediumAuto-gradedDetect Target Pair in Spiral Matrix Order
Determine if two distinct cells in a 2D matrix sum to a target integer while processing elements in spiral order.
Arrays & Hashingarrayshash-tablematrix - Arrays & HashingMediumAuto-gradedCount Disjoint Pairs That Add Up to a Goal Value
Find the most disjoint pairs in an integer list whose sum equals a goal, using value counts or sorting with two pointers, while handling duplicates, negatives and the half-goal case.
Arrays & Hashinghash-maptwo-pointersgreedycounting - Arrays & HashingMediumAuto-gradedCount Maximum Disjoint Pairs Summing to a Target
Find the most index-disjoint pairs in an integer array whose values add up to a target, testing hashing of complements, counting, and handling of the self-pairing case.
Arrays & Hashinghash-mapcountingtwo-pointersgreedy - Arrays & HashingMediumAuto-gradedClosest Bakery Stall for Every Shopper on a Street
For each shopper on a line, find the closest stall index, with ties going to the lower index, testing two-sided linear scans for nearest-neighbor lookups.
Arrays & Hashingarraystwo-pointersprefix-suffixnearest-neighbor - Arrays & HashingMediumAuto-gradedCount Index Pairs With a Fixed Value Gap
Count index pairs i < j whose values differ by exactly k, using a frequency map and handling the k = 0 case separately to avoid double counting.
Arrays & Hashinghash-mapcountingfrequencypairs - Arrays & HashingMediumAuto-gradedCollapse Rapid Cart Adds into Daily Pacific Action Counts
Filter add-to-cart events, convert UTC to Pacific dates, merge rapid repeats into single actions with a chained gap rule, and count the actions per user, date and SKU.
Arrays & Hashinghashinggroupingdatetimetimezones