practice a little every day — you've got this ♡
Arrays & Hashing Interview Problems
Practice 5967 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.
- 5967
- Problems
- 2210
- Auto-graded
- 15
- Topics
- 272
- Added today
Showing 1–30 of 435 results
- Arrays & HashingEasyAuto-gradedFlagged Account Precision and Expected Alert Counts
Apply Bayes' rule and expected-count arithmetic to a fraud classifier, returning the posterior precision of a flag plus the expected hits, false alarms and error rates.
Arrays & Hashingbayes-theoremconfusion-matrixprobabilityprecision - Arrays & HashingMediumAuto-gradedShortest Window Holding Exactly k Different Values
Find the shortest contiguous slice of an integer list containing exactly k different values, using a sliding window with frequency counts.
Arrays & Hashingsliding-windowhash-mapsubarraytwo-pointers - Arrays & HashingEasyAuto-gradedCheck a Call Against a Catalog of Function Signatures
Decide whether an ordered list of argument types fits any function in a catalog, given required, trailing optional, and variadic parameters with exact type matching.
Arrays & Hashingsimulationarray-scanningsignature-matchingedge-cases - Arrays & HashingMediumAuto-gradedShortest Subarray with K Unique Values
Find the minimum length of a contiguous subarray containing at least K unique elements using a sliding window.
Arrays & Hashingsliding-windowtwo-pointershash-tablearrays - Arrays & HashingEasyAuto-gradedMaximum Gain from Single Asset Trade
Determine the maximum possible gain achieved by completing at most one purchase and sale transaction over a sequence of prices.
Arrays & Hashingarraysgreedyprefix-minimum - Arrays & HashingMediumAuto-gradedLeave-One-Out Products Without Using Division
Build an array where each entry is the product of all other entries, without division, in linear time, using prefix and suffix running products.
Arrays & Hashingprefix-productsuffix-productarrayin-place - Arrays & HashingMediumAuto-gradedPer-Move Win Tracker for a Square Noughts-and-Crosses Grid
Replay a sequence of marks on an n-by-n grid and report after each one whether the mover has completed a row, column or diagonal, using per-line counters.
Arrays & Hashingsimulationcountingmatrixdiagonals - Arrays & HashingEasyAuto-gradedFind Peak Positions in an Integer Sequence
Scan an integer list and return the indices of elements strictly larger than every neighbor that exists, handling the ends, plateaus, and tiny inputs correctly.
Arrays & Hashingarraystraversalboundary-conditions - Arrays & HashingMediumAuto-gradedQuickest Kilometer Within a Run Recorded in 5-Second Splits
Find the highest average speed over any 1000 m stretch of a run given per-5-second distances, using prefix sums, binary search and interpolation at boundaries.
Arrays & Hashingprefix-sumsbinary-searchsliding-windowinterpolation - Arrays & HashingEasyAuto-gradedEarliest Strict Valley in an Integer Sequence
Scan an integer list for the leftmost interior value strictly smaller than both adjacent values, returning -1 if none exists, which tests boundary handling and strict comparisons.
Arrays & Hashingarrayscanboundary-conditionsstrict-comparison - Arrays & HashingMediumAuto-gradedChain-Reaction Tile Clearing on a Grid
Simulate a grid game where runs of three or more equal tiles vanish together, tiles fall down, and the process repeats until the grid is stable.
Arrays & Hashingsimulationmatrixtwo-pointersgrid - Arrays & HashingMediumAuto-gradedFind Members Missing a Nearby Provider Specialty
Given providers and members on a 2D plane, find members with a required specialty that has no provider within a distance limit, using hashing and spatial grouping.
Arrays & Hashinghashinggeometrygrid-bucketingsimulation - Arrays & HashingEasyAuto-gradedLongest Strictly Rising Streak in a Row of Readings
Scan an integer list once to find the longest block of adjacent, strictly rising values, handling empty input, equal neighbors, and runs that reach the end.
Arrays & Hashingarrayssliding-windowtwo-pointerslinear-scan - Arrays & HashingMediumAuto-gradedFirst-Week Post Totals and Week-Later Return Share
Group dated activity rows by user, find each user's earliest date, total posts in the first seven days, and compute the share of users active on day 7 or later.
Arrays & Hashinghash-mapdatesaggregationcohort-analysis - Arrays & HashingEasyAuto-gradedLedger Replay Cleanup: Apply Each Payment Event Once
Process a stream of possibly redelivered payment events and compute final account balances by applying each unique event ID only once.
Arrays & Hashinghash-sethash-mapdeduplicationsimulation - Arrays & HashingMediumAuto-gradedShortest Total Flight on a Circular Track of Stations
Sum the shortest arc distances between consecutive stops on a ring with weighted edges, using prefix sums for O(1) arc queries.
Arrays & Hashingprefix-sumcircular-arraysimulation - Arrays & HashingHardAuto-gradedIdentify Most Popular Three-Page User Sequence
Process website activity logs to compute chronological 3-site visit subsequences and find the most widely performed pattern across unique users.
Arrays & Hashingarrayshash-tablesortingsubsequence - Arrays & HashingEasyAuto-gradedRank Companion Items by Shared Collections
Count how often each item shares a collection with a target item, then rank by count descending and name ascending, with an optional cap on the result length.
Arrays & Hashinghash-mapcountingsortingco-occurrence - Arrays & HashingMediumAuto-gradedThree-Bucket Rearrangement With Constant Extra Space
Tests in-place three-way partitioning of an array holding only 0, 1 and 2 using constant extra space and a single linear pass, with careful pointer invariants.
Arrays & Hashingtwo-pointersin-placepartitioningsorting - Arrays & HashingMediumAuto-gradedRepeat Visitors Across UTC Days in an Event Feed
Normalize ISO 8601 timestamps to UTC dates and use hashing to find users active on at least two distinct UTC calendar days.
Arrays & Hashinghashingdatetimetimezonelogs - Arrays & HashingMediumAuto-gradedLongest Daily Purchase Streak for Each Customer
Group purchase records by customer, collapse same-day duplicates, and find the longest run of back-to-back calendar days, reporting results sorted by customer id.
Arrays & Hashinghashingsortingdatesgaps-and-islands - Arrays & HashingMediumAuto-gradedDistinct Value Foursomes Hitting a Target Total
Find every distinct set of four values, taken from different positions, that add up to a target, with no repeated value combinations in the output.
Arrays & Hashingtwo-pointerssortingdeduplicationk-sum - Arrays & HashingEasyAuto-gradedCount Shoppers With Visits on Two or More Days
Group log entries by person and ignore repeats on the same day, then count how many people appear on at least two different calendar days.
Arrays & Hashinghash-sethash-mapgroupingdeduplication - Arrays & HashingMediumAuto-gradedCascading Tile Crush on a Grid
Simulate a tile-crush game: mark all runs of 3+ equal tiles, clear them, drop tiles with gravity, and repeat until stable, counting removed tiles.
Arrays & Hashingsimulationmatrixtwo-pointersgrid - Arrays & HashingMediumAuto-gradedZigzag Parity Check on Subarray Ranges
Answer many range queries asking whether neighbors in a subarray always differ in odd/even parity, using prefix counts of same-parity adjacent pairs.
Arrays & Hashingprefix-sumrange-queriesparityarrays - Arrays & HashingEasyAuto-gradedWord-Count Cosine Score for Two Text Strings
Compute the cosine of the angle between the word-frequency vectors of two strings, using a hash-map counter and guarding against empty inputs.
Arrays & Hashinghash-mapcountingstringsmath - Arrays & HashingMediumAuto-gradedCount Squares Spanned by Crossing Vertical and Horizontal Segments
Count axis-aligned squares whose four corners all lie where a vertical segment meets a horizontal one, using per-row bitmasks and pairwise row comparison.
Arrays & Hashinggeometrybitmaskhashingenumeration - Arrays & HashingMediumAuto-gradedCheck Whether Two Custom Dice Give a Flat Sum Distribution
Decide whether two lists of die-face labels make every total from 1 to 12 appear exactly three times across all 36 face pairings, using pair counting.
Arrays & Hashingcountinghash-mapenumerationprobability - Arrays & HashingEasyAuto-gradedGroup Identical Files by Content from an In-Memory Listing
Group file entries that have identical byte content, using content length as a cheap first filter, and return only groups of two or more paths in a specified order.
Arrays & Hashinghashinggroupingstringssimulation - Arrays & HashingMediumAuto-gradedTally Contiguous Segments Matching a Goal Total
Count contiguous non-empty segments of an integer array whose sum equals a goal, using running totals and a frequency map to handle negatives and zeros in linear time.
Arrays & Hashingprefix-sumhash-mapsubarraycounting