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 211–240 of 477 results
Find the leftmost column holding a 1 in a binary grid whose rows are sorted, aiming for a linear-time walk instead of scanning every cell.
Auto-gradedmatrixtwo-pointersbinary-matrixstaircase-searchGroup impression records by country and user over a 7-day window, flag users with 4+ active dates and 3+ surfaces on one date, and report per-country percentages.
Auto-gradedhash-mapgroupingsetsdate-handlingFind the shortest contiguous block whose removal leaves a non-decreasing array, using sorted prefix/suffix boundaries and two pointers, with a smallest-start tie-break.
Auto-gradedtwo-pointersarraysprefix-suffixgreedyDecide whether one value from each of two sorted lists adds up to a target, using a linear-time opposite-direction two-pointer scan with constant extra space.
Auto-gradedtwo-pointerssorted-arraystwo-sumoverflow-safetyEstimate a population-wide event rate from samples drawn with known unequal inclusion probabilities, using inverse-probability weighting divided by the population size.
Auto-gradedinverse-probability-weightingsamplingestimationhorvitz-thompsonSimulate a rover on a bounded rectangular grid that turns, steps forward, and steps backward, skipping any step that leaves the grid or enters a blocked cell.
Auto-gradedsimulationhash-setgridmodular-arithmeticCount positions whose removal makes the sum at even positions equal the sum at odd positions, testing prefix/suffix sums and the parity shift after a deletion.
Auto-gradedprefix-sumsparityarraycountingJoin order, product and category records, group by category name, and compute total revenue, mean revenue per row and the share of completed rows, using hash maps.
Auto-gradedhash-mapaggregationjoingroupingSort card authorization events by time and apply permanent, time-activated block rules to label each as APPROVE or REJECT, testing stable sorting, two-stream merging and hashing.
Auto-gradedhashingsortingsimulationtwo-pointersDesign a way to merge two key-value maps, extend it to k maps, and decide which conflict rules must be pinned down before writing any code.
Model answerhash-mapmergingapi-designclarifying-questionsFill None cells in a table column by column with the mean, median or smallest-most-frequent value of the observed entries, without mutating the input.
Auto-gradedarrayssimulationstatisticsdata-cleaningFill in the blanks of a 9x9 digit grid so every row, column and 3x3 block holds each digit 1-9 once, testing backtracking with constraint pruning.
Auto-gradedbacktrackingconstraint-satisfactionbitmaskrecursionCompute total rainwater stored between unit-width columns of given heights, aiming for a single pass with constant extra memory using the two-pointer technique.
Auto-gradedtwo-pointersarraysgreedyFind the two distinct positions in an integer list whose values sum to a goal, using a single-pass hash map lookup instead of checking every pair.
Auto-gradedhash-maparrayscomplement-lookupCompute the per-group sample size for a two-proportion test from a given formula, and update a Beta prior with observed Bernoulli outcomes.
Auto-gradedstatisticspower-analysisbayesian-updatebeta-binomialCount senders and receivers from signed transfer records in a single pass, then pick the five most frequent on each side with a deterministic tie-break.
Auto-gradedhash-mapcountingheapstreamingBuild a new list that alternates positives and negatives (starting positive), keeps same-sign order, appends leftover elements, and places zeros last.
Auto-gradedarraystwo-pointersstable-partitionsimulationCombine a prefix-sum hash map to count contiguous slices summing to a target with a grid flood fill to find the largest 4-connected cluster of buildings.
Auto-gradedprefix-sumhash-mapflood-fillgridSliding-window problem: for each end index find the shortest suffix with at least 1000 meters, compute its average speed, and return the maximum across all end indices.
Auto-gradedsliding-windowtwo-pointersprefix-sumsarraysScan a list of employee records and keep those meeting every enabled optional range or membership rule, preserving order and leaving the input untouched.
Auto-gradedfilteringhash-setoptional-parameterssimulationSimulate a fit/predict command sequence for a linear model trained with batch gradient descent on mean squared error, using plain Python lists.
Auto-gradedgradient-descentlinear-regressionmsesimulationCount contiguous subarrays whose sum has a given remainder using prefix-sum remainders, and delete the fewest parentheses to balance a string in a fixed, deterministic way.
Auto-gradedprefix-summodular-arithmetichash-countinggreedyProcess payments in order, pairing each with an invoice by ID plus amount, then by unique amount, then by closest amount within a percentage tolerance.
Auto-gradedhash-mapsimulationmatchingfloating-pointSimulate a marble on a grid whose tilt changes at scheduled times, and find its final cell efficiently when the end time can reach a billion seconds.
Auto-gradedsimulationgridtime-segmentstwo-pointersFind the largest gain from buying and later selling the same ticker on a strictly later date, given an unsorted log with duplicate dates; tests grouping, sorting and careful running-minimum updates.
Auto-gradedhash-mapsortinggreedytime-seriesTests hash-map frequency counting: find every string occurring more than once in a list and report its count, using exact comparison.
Auto-gradedhash-mapcountingstringsfrequencyRandomly assign eligible ads to page positions for one user, respecting per-user display caps, avoiding repeats when possible, and returning the updated view counts.
Model answerrandomizationhash-mapshuffleresource-allocationCount occurrences of each string in a list with a hash map, then rank by count with an alphabetical tie-break to extract the top three entries.
Auto-gradedhash-mapcountingsortingtie-breakingCompute the smallest equal group size for a two-sided two-proportion z-test, given a baseline rate, relative uplift, significance level and target power.
Auto-gradedstatisticssample-sizepower-analysisab-testingEnumerate every subarray whose length is a power of two and whose sum falls in [k, 2k], using prefix sums to get an O(n log n) solution with ordered output.
Auto-gradedprefix-sumsliding-windowsubarrayenumeration