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 241–270 of 477 results
Fit a slope and intercept to 2D points by running deterministic mini-batch gradient descent on mean squared error, with exact batching, update order and edge-case rules.
Auto-gradedgradient-descentlinear-regressionmini-batchoptimizationCount occurrences across two combined lists, keep values seen exactly once, and return the k-th largest of them or -1 if there are fewer than k.
Auto-gradedhash-mapcountingsortingheapMerge two sorted lists into the first, which has trailing spare slots, without extra memory; tests back-to-front two-pointer merging.
Auto-gradedtwo-pointersin-placesortingmergeIncrement a large non-negative number stored as a digit list by one, handling carry propagation and length growth without converting to an integer.
Auto-gradedarrayscarrysimulationmathCompute expected value and variance, a dice conditional probability, a Poisson tail, betting edge with Kelly sizing, and a without-replacement card probability in one function.
Auto-gradedprobabilityexpected-valueconditional-probabilitypoissonTests filtering a list of tagged records and computing rolling window totals in O(n) using an incremental sum instead of recomputing each window.
Auto-gradedsliding-windowprefix-sumfilteringarraysTests prefix-sum reasoning with hashing: detecting a contiguous run of length at least two whose sum is divisible by k, including the k = 0 special case.
Auto-gradedprefix sumhash mapremainderssubarrayTests greedy reasoning, frequency counting, and backtracking search to maximize the combined distinct-value count across two arrays given a limited swap budget.
Auto-gradedbacktrackinggreedyfrequency-countingTests building a complete calendar spine, counting distinct daily users, and maintaining a 30-day rolling active-user window.
Auto-gradedhash-mapsliding-windowdate-manipulationTests whether you can encode all win conditions for a 3×3 grid as data and apply a uniform check to identify a winning player.
Auto-gradedarraysgame-theorysimulationFind the minimum index gap between any occurrence of two distinct words in a list using single-pass tracking.
Auto-gradedarraystringsingle-passtwo-pointerTests your ability to invert a membership index and use co-occurrence counting to efficiently find all pairs sharing at least k common items.
Auto-gradedhash-mapsetsco-occurrenceinverted-indexTests the sliding-window technique: conditionally compact a list of records to the longest contiguous run whose token sum fits a given budget.
Auto-gradedsliding-windowarraystwo-pointersBuild a TDD plan, concrete cases, property invariants and stress tests for two grid word-search functions that must disagree on key inputs.
Model answertestingtddgridsbacktrackingCount splits where prefix and suffix share more than k letters, then find the target cost that yields the most single-or-pair packages.
Model answercountingfrequency-arrayshash-mapcombinatoricsDetermine which grid cells remain in bounds after a sequence of directional shifts, testing displacement tracking and boundary analysis.
Auto-gradedsimulation2d-arrayprefix-summathTests simulation of a daily rebalancing strategy where portfolio weights are proportional to positive asset returns, requiring correct timeline logic and statistical output.
Auto-gradedsimulationfinancestatisticsGenerate an n×n matrix of fair coin-flip entries and rescale each column so its values sum to 1, in O(n²) time.
Model answernumpymatrixnormalizationvectorizationTests whether a candidate can copy a rectangular subregion of a 2D grid onto another position in the same grid, in place, without corrupting overlapping data.
Auto-gradedarraysin-placetwo-dimensionalDistribute k tokens clockwise across n nodes in a ring starting at a given index, returning each node's final count without simulating one token at a time.
Model answerarraysmathmodulo arithmeticSliding-window task where the window score is the sum of its distinct values, not the plain sum of its elements.
Auto-gradedsliding-windowhash-maptwo-pointersarraysImplement a function that draws one item from a list at random, where each item's selection probability is proportional to its given weight.
Model answerprobabilityprefix-sumbinary-searchTests ability to validate, filter, sort, and paginate structured records while handling malformed entries and boundary conditions correctly.
Auto-gradedarraysfilteringpaginationCompute expected optimal winnings when sequentially guessing coin flips with a uniform-prior unknown bias.
Auto-gradedprobabilitybayesianexpected-valuedynamic-programmingGiven a solution to a subarray-sum problem, explain your approach, prove it correct, analyze complexity, and compare it to at least two alternatives.
Model answerprefix-sumhash-mapcomplexity-analysiscommunicationTests prefix-sum reasoning, hash-map lookups, and precise tie-breaking to find the longest subarray summing to exactly k.
Auto-gradedprefix-sumshash-maparraysFix async pool usage so results are collected in order, worker errors surface, and one JSON file is written.
Auto-gradedmultiprocessingconcurrencydebuggingfile-ioTests in-place array manipulation with two-pointer technique to remove duplicates from a sorted sequence.
Auto-gradedtwo-pointersin-placesorted-arrayTests ability to count outcome classes for three N-sided dice and combine probability-weighted payoffs into an expected value, including a sign-flip variant.
Auto-gradedexpected-valueprobabilitycountingTests ability to implement the full k-means loop — initialization, Euclidean assignment, centroid update, convergence check, and empty-cluster handling — in plain Python.
Auto-gradedclusteringiterative-algorithmsnumerical