Curated sets

Interview warm-up

Short whiteboard tasks to get the rust off.

All problems
Total results2,493 problems
TopicsJudge
Obfuscated TreesDecode a tree from its obfuscated token stream, where each internal node carries an ordering code and subtree count, then print its values in pre-order.Medium4TreeRecursion+1No attempts yet2s512 MBJudgeable
The Door to the Treasure RepositoryFor each pair of integers, compute each key number (largest distinct prime factor minus the sum of the others) and print the one with the larger key.Medium4Number theoryMath+2No attempts yet8s512 MBJudgeable
Overwatch World CupOne seat in an N by N grid breaks the rule that every row and column holds each team once; find the seat and the correct shirt.Medium4ImplementationHash mapNo attempts yet2s512 MBJudgeable
Careful AscentGiven a target point and vertical strips that scale horizontal speed, find the launch horizontal velocity so the craft reaches the target at vertical speed 1.Medium4MathImplementation+2No attempts yet2s512 MBJudgeable
Contest ScoreSimulate reading problems in order but solving the shortest available one first, keeping at most k in memory, and report the total submission time.Medium4SimulationHeap+1No attempts yet2s512 MBJudgeable
GravityApples fall straight down until they rest on obstacles or the floor; print the final grid.Medium4SimulationImplementationNo attempts yet1s512 MBJudgeable
Hidden PalindromeGiven a word of at most 40 lowercase letters, find the longest palindromic subsequence obtainable by deleting letters from the front and back.Medium4Dynamic programmingString+2No attempts yet2s512 MBJudgeable
Arrival TimeSimulate a drive that takes 2 hours normally but twice as long while traffic runs 07:00-10:00 and 15:00-19:00, given an on-the-hour, :20, or :40 departure.Medium4SimulationImplementation+1No attempts yet2s512 MBJudgeable
Tandem BicyclePair each Dmojistan rider with a Pegland rider to minimize or maximize the sum of the larger speed in each pair.Medium4GreedySorting+2No attempts yet2s512 MBJudgeable
TunnelGiven the entry order and exit order of N cars through a tunnel, count how many cars must have overtaken another car.Medium4ArrayHash map+2No attempts yet2s512 MBJudgeable
Amusement Park QueueTwo people walk a fixed grid path one step per minute, offset by K minutes; count the minutes their cells touch in any of eight directions.Medium4SimulationImplementation+2No attempts yet1s128 MBJudgeable
Wheat HarvestFind each connected block of 1s, order blocks by area, and label every cell with its block's rank.Medium4GraphDFS+1No attempts yet1s128 MBJudgeable
Sum of Divisor SumsGiven L and R, compute the sum of divisor sums f(n) for every n from L to R.Medium4MathNumber theory+1No attempts yet1s64 MBJudgeable
Counting HaybalesGiven N distinct haybale positions and Q interval queries, count how many positions fall inside each inclusive range [A, B].Medium4SortingBinary search+2No attempts yet2s512 MBJudgeable
Road work and the distance to the capitalAfter each of q edge insertions and deletions, output the shortest-path distance from every city to city 1, or -1 if unreachable.Medium4BFSGraph+2No attempts yet2s512 MBJudgeable
The nearest convenience storeGiven an undirected weighted graph with some vertices marked as homes and others as stores, pick the home whose shortest-path distance to the nearest store is smallest, breaking ties by vertex number.Medium4GraphShortest path+2No attempts yet2s512 MBJudgeable
Box PackingGiven box sizes in order, find the longest subsequence where each box is strictly smaller than the next, counting boxes in the pile.Medium4Dynamic programmingBinary search+2No attempts yet2s512 MBJudgeable
Merging SlimesMerge N slimes two at a time, scoring the product of merged sizes, and maximize the total score.Medium4GreedySortingNo attempts yet2s512 MBJudgeable
Jump JumpGiven jump distances on a row of n stones, count how many stones are reachable from a starting stone via left or right jumps that stay on the bridge.Medium4GraphBFS+2No attempts yet2s512 MBJudgeable
Company culture 1Given each employee's manager and a list of praises, propagate every praise value down the whole subtree and print the total each employee receives.Medium4TreeDFS+2No attempts yet2s512 MBJudgeable
Safe Squares (Small)Count all axis-aligned D by D subgrids of an R by C grid that contain no monster cell.Medium4Dynamic programmingMatrix+2No attempts yet5s512 MBJudgeable
Evaluation Order of Assignments (Small)Given assignment statements where each expression is a function call, decide whether some order evaluates every variable, which fails exactly when a dependency cycle exists.Medium4GraphTopological sort+2No attempts yet5s1024 MBJudgeable
Close Match (Small)Fill in the question marks in two equal-length digit strings to minimize the absolute difference between the values, breaking ties by minimizing the first then the second.Medium4Brute forceImplementation+2No attempts yet5s512 MBJudgeable
The Last Word (Large)Insert each letter of S at the front or back of the growing word so the final string is as large as possible lexicographically.Medium4GreedyString+1No attempts yet5s512 MBJudgeable
Revenge of the Pancakes (Large)Given a stack of pancakes as a string of + and -, find the minimum number of top-prefix flips needed to make every pancake show its happy side.Medium4GreedyString+1No attempts yet5s512 MBJudgeable
BeachCount the hexagon edges that separate land from water, ignoring any edge on the outer border of the map.Medium4ImplementationMatrix+2No attempts yet2s512 MBJudgeable
OvertimeGiven timestamped enter and leave records, count overtime as unmatched leaves plus unmatched enters per name after pairing.Medium4Hash mapStack+2No attempts yet2s512 MBJudgeable
Resource MiningA robot walks from the top-left to the bottom-right cell of an N by M grid using only right and down moves; find the largest number of resource cells it can pass through.Medium4Dynamic programmingMatrix+2No attempts yet2s256 MBJudgeable
Cow TippingGiven an N by N grid of 0s and 1s, find the minimum number of upper-left rectangles to toggle so all cells become 0.Medium4GreedyArray+2No attempts yet2s512 MBJudgeable
Hunter's ApprenticeGiven the vertices of a simple polygon in the order placed, decide whether they run counter-clockwise (print fight) or clockwise (print run).Medium4GeometryMathNo attempts yet2s512 MBJudgeable
GwailnoriGiven each segment's bot cycle of a seconds with b active, find the earliest time to traverse all N segments in order, waiting whenever a segment is active on arrival.Medium4SimulationMath+2No attempts yet2s512 MBJudgeable
When Geudae Becomes GeumeoGiven N characters and M replacement pairs, find the minimum number of substitutions needed to convert character a into character b.Medium4GraphBFS+1No attempts yet2s512 MBJudgeable
Rolling a DiceRoll a dice on an N by M grid, updating the cell under it and the dice faces each move, and print the top face after every successful move.Medium4SimulationImplementation+1No attempts yet2s512 MBJudgeable
Robot Vacuum CleanerSimulate a robot vacuum that cleans cells, rotating counterclockwise and moving forward or backward, and count how many cells it cleans before stopping.Medium4SimulationImplementation+2No attempts yet2s512 MBJudgeable
Yin and Yang StonesGiven a circular string of black and white stones, decide whether repeated merges can reduce it to one black and one white stone.Medium4StringGreedy+1No attempts yet2s512 MBJudgeable
Bovine Genomics (Silver)Count triples of genome positions where no spotty cow and plain cow share the same three characters.Medium4Brute forceHash map+2No attempts yet2s512 MBJudgeable
Street light polesGiven a binary r by c grid, find the minimum number of cell flips so every row has equal pole count and every column has equal pole count, or -1 if impossible.Medium4ImplementationMathNo attempts yet2s512 MBJudgeable
The fastest road to BanikoaraGiven towns joined by undirected weighted roads, find the shortest travel distance between a named departure town and destination town.Medium4GraphShortest path+2No attempts yet2s512 MBJudgeable
Additive and multiplicative inversesGiven N and A, print the additive inverse of A modulo N and the multiplicative inverse if it exists, otherwise -1.Medium4Number theoryMath+1No attempts yet1s128 MBJudgeable
Prerequisite CoursesGiven prerequisite pairs between courses, find the earliest semester each course can be completed when unlimited courses may be taken per semester.Medium4GraphTopological sort+2No attempts yet5s256 MBJudgeable
Image quilting (large)Given two grayscale overlap regions of H rows and W columns, pick one column per row so adjacent rows differ by at most one, minimizing the total squared pixel difference.Medium4Dynamic programmingMatrix+1No attempts yet1s512 MBJudgeable
Pizza (Large)Split a tower of N into unit towers, scoring the product of the two parts at each split, and maximize the total score.Medium4GreedyMath+2No attempts yet1s512 MBJudgeable
Chonggang ChonggangRun a single-source shortest path from Jinseo's house, find the nearest type A and type B house, and report the closer type (A wins ties).Medium4Shortest pathGraph+2No attempts yet1s256 MBJudgeable
Frozen FoodCount the minutes from a start time to an end time, inclusive, whose HH:MM display contains the digit N at least once.Medium4ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Need for SpeedGiven segment distances and speedometer readings plus a total time, find the constant offset c making the summed travel times equal t.Medium4Binary searchMath+1No attempts yet1s512 MBJudgeable
Secret Chamber at Mount RushmoreGiven directed letter translations, decide for each pair of words whether every letter of the first can reach the matching letter of the second.Medium4GraphDFS+2No attempts yet1s512 MBJudgeable
A Taste of QueriesGiven a sequence of n numbers, process q queries that either report a range sum and then swap two positions, or report one range sum minus another.Medium4ArrayPrefix sum+2No attempts yet2s256 MBJudgeable
Stephen QuerySimulate N rounds of survival rock paper scissors and report the longest number of consecutive wins by any single player.Medium4SimulationImplementation+1No attempts yet2s256 MBJudgeable
The TA is a sadist!!Given a permutation of 1 to N, find the minimum number of elements to remove so the remaining values increase from front to back.Medium4Dynamic programmingBinary search+2No attempts yet2s256 MBJudgeable
STOP USING MONEYSort N games by satisfaction-to-price ratio, then by lower price, then by game number, and print the first K game numbers.Medium4SortingMath+2No attempts yet1s512 MBJudgeable
Cut Vertices and BridgesGiven a tree with N vertices and queries, report for each query whether a specified vertex is a cut vertex or a specified edge is a bridge.Medium4TreeDFS+2No attempts yet1s512 MBJudgeable
Venue Rental (Small)Given up to 100 axis-aligned rectangles, find the area of the union of all rectangles.Medium4ArrayImplementation+2No attempts yet2s256 MBJudgeable
Pizza BoxesGiven a grid of distinct pile heights, find how many boxes can be removed while keeping the per-row and per-column maxima unchanged.Medium4ArrayGreedy+2No attempts yet1s512 MBJudgeable
Steed 2: Cruise Control (Small)Given horses ahead on a one-way road that slow to match slower horses they catch, find the fastest constant speed Annie can hold to her destination without ever passing one.Medium4MathImplementation+2No attempts yet5s512 MBJudgeable
Ample Syrup (Small)Choose K pancakes from at most 10 to stack largest radius on the bottom, maximizing the exposed surface area divided by pi.Medium4Brute forceSorting+2No attempts yet5s512 MBJudgeable
Jaehong's LadderGiven a rectangle's width, height, and a number of vertical strips, sum the lengths of the N-1 rungs where the strips cross the rectangle's diagonals.Medium4MathGeometry+2No attempts yet2s512 MBJudgeable
Sum of all pairwise productsGiven n integers, compute the sum of x_a * x_b over all pairs with a < b.Medium4MathPrefix sum+2No attempts yet2s512 MBJudgeable
Almost Identical ProgramsGiven two program strings, decide whether they are identical, differ only in one string literal at the same position, or are otherwise different.Medium4StringImplementation+1No attempts yet2s512 MBJudgeable
Forbidden ZeroGiven a positive integer n with no digit 0, find the next integer in increasing order that also contains no digit 0.Medium4MathImplementation+2No attempts yet1s512 MBJudgeable
Filling an Arithmetic SequenceTwo terms of a ten-term arithmetic sequence are given at unknown positions; fill in the rest with integers or report that no integer completion exists.Medium4MathNumber theory+2No attempts yet2s512 MBJudgeable
Police StationIn a directed graph, list every vertex from which all other vertices are reachable by following arrows forward.Medium4GraphDFS+1No attempts yet2s1024 MBJudgeable
Wet Rock Peg PlanSimulate a sequence of peg placements and removals on a dependency DAG, tracking peak peg count and the first wet-rule violation.Medium4SimulationGraph+2No attempts yet2s512 MBJudgeable
Olympiad PizzaContestants queue for pizza slices; each takes one slice per turn and rejoins the back if still hungry. Report the second each finishes.Medium4QueueSimulation+2No attempts yet2s512 MBJudgeable
Frosh WeekGiven task durations and quiet-interval lengths, each between 100000 and 199999, pair tasks with intervals that fit them and maximize the number of completed tasks.Medium4GreedyTwo pointers+2No attempts yet4s512 MBJudgeable
ZigZagGiven K words and N letters, output for each letter the word starting with it that has been used fewest times, breaking ties alphabetically.Medium4SortingHash map+2No attempts yet2s64 MBJudgeable
Street LightsGiven existing street lights that each cover K metres to both sides, find the minimum number of extra lights needed to light every metre from 1 to N.Medium4GreedySorting+2No attempts yet1s64 MBJudgeable
How to Eat at a BuffetGiven a plate area and items with value per area and available area, pick fractions to maximize total value on the plate.Medium4GreedySortingNo attempts yet2s512 MBJudgeable
Frosting on the CakeGiven vertical stripe widths A and horizontal stripe heights B, find the total area of each of the three colors where each cell's color is (i+j) mod 3.Medium4ArrayMath+2No attempts yet5s512 MBJudgeable
GlitchBotFind which single instruction in a list of Left, Right, and Forward must be changed, and to what, so the robot ends at the given target.Medium4SimulationBrute force+1No attempts yet2s512 MBJudgeable
Wizard of OddsGiven N possible secret numbers and K yes/no questions, decide whether K adaptive questions always identify the number, where K questions distinguish at most 2^K outcomes.Medium4MathBinary search+2No attempts yet2s512 MBJudgeable
Treasure HuntFollow a grid of arrows from the top-left cell and report the number of steps to the treasure, Out if you leave the grid, or Lost if you loop forever.Medium4SimulationGraph+2No attempts yet2s512 MBJudgeable
The Bovine ShuffleGiven a permutation describing one shuffle and the cow order after three shuffles, recover the original order before the shuffles.Medium4ArrayImplementation+2No attempts yet2s512 MBJudgeable
Milk MeasurementThree cows start at 7 gallons; apply N dated changes in chronological order and count the days on which the set of cows holding the top output changes.Medium4SimulationSorting+2No attempts yet2s512 MBJudgeable
Coloring IntervalsGiven n closed intervals with distinct endpoints, find the minimum number of colors so that overlapping intervals get different colors.Medium4SortingIntervals+2No attempts yet3s512 MBJudgeable
WindowGiven N panes of size W by H, slide odd-indexed panes east and even-indexed panes west by given distances, then compute the uncovered window area.Medium4ArraySimulation+2No attempts yet2s512 MBJudgeable
Best Matched PairGiven up to 1000 distinct integers, find the largest product of two whose product's decimal digits form a consecutive increasing run like 123; print -1 if none exists.Medium4ImplementationBrute force+2No attempts yet2s512 MBJudgeable
N and M (7)Given N distinct numbers and a length M, print every length-M sequence drawn from the numbers with repetition allowed, deduplicated and in increasing lexicographic order.Medium4BacktrackingRecursion+2No attempts yet1s512 MBJudgeable
N and M (9)Given N numbers (with duplicates) and length M, print every distinct length-M selection in increasing lexicographic order, using each copy at most once.Medium4BacktrackingSorting+1No attempts yet1s512 MBJudgeable
N and M (11)Given N numbers and a length M, list every length-M sequence drawn from the numbers, allowing repeats, in increasing lexicographic order without duplicates.Medium4BacktrackingRecursion+2No attempts yet1s512 MBJudgeable
N and M (12)Given N numbers and a length M, list all non-decreasing length-M sequences drawn from the numbers with repetition, in lexicographic order.Medium4BacktrackingSorting+2No attempts yet2s512 MBJudgeable
OthelloGiven the sequence of moves of a valid 6x6 Othello game, replays them and prints the final board plus the winner.Medium4SimulationImplementation+2No attempts yet1s128 MBJudgeable
Word Search in a GridDecide whether a word appears in a grid along a straight line of neighboring cells in any of the eight directions.Medium4ArraySimulation+2No attempts yet2s512 MBJudgeable
N-Step SyllogismEach premise says all a are b; for each conclusion x is y, decide whether following the implication chain from x reaches y.Medium4GraphDFS+2No attempts yet2s128 MBJudgeable
JujisuGiven an N by M grid of populations, answer K queries for the sum of people inside each requested rectangle.Medium4Prefix sumArray+2No attempts yet2s512 MBJudgeable
Counting equilateral trianglesGiven a triangular tower with N layers of unit triangles, count every equilateral triangle of any size, both upward and downward pointing.Medium4MathCombinatorics+2No attempts yet1s128 MBJudgeable
Big Integer A+BRead two integers up to 10^10000 in magnitude and print their sum without using built-in big integer support.Medium4ImplementationString+2No attempts yet1s512 MBJudgeable
HoofballSort cows by position, then find the minimum number of starting balls so every cow receives the ball at least once under the nearest-cow passing rule.Medium4SortingGraph+1No attempts yet2s512 MBJudgeable
Taming the HerdGiven a partial daily log of days-since-breakout values with a breakout on day 1, find the minimum and maximum possible breakouts.Medium4GreedyArray+2No attempts yet2s512 MBJudgeable
Lemonade LineGiven each cow's maximum tolerated queue length, choose an arrival order that minimizes how many cows end up waiting in line.Medium4GreedySorting+2No attempts yet2s512 MBJudgeable
SegmentationTrack visits per user over time and answer queries by mapping each user's recency and frequency to one of 12 RF segments.Medium4Hash mapImplementation+2No attempts yet1s1024 MBJudgeable
Balance StoneOne cell of an N by N grid is 0; find the number M that makes all rows, columns, and both diagonals share one common sum, or print -1.Medium4ImplementationMath+1No attempts yet1s512 MBJudgeable
Aku NegarakuFor each N and M, simulate Josephus elimination around a circle and report the last remaining trainee's number.Medium4SimulationArray+1No attempts yet3s512 MBJudgeable
Binary CountingGenerate the binary representation of each non-negative integer in order, concatenate the digits, and print every n-th digit starting at position k (five of them).Medium4ImplementationMath+2No attempts yet1s32 MBJudgeable