Curated sets
Interview warm-up
Short whiteboard tasks to get the rust off.
Total results2,493 problems
| Topics | Judge | |||||
|---|---|---|---|---|---|---|
| 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. | Medium4 | TreeRecursion+1 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | Number theoryMath+2 | No attempts yet | 8s | 512 MB | Judgeable |
| 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. | Medium4 | ImplementationHash map | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | MathImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | SimulationHeap+1 | No attempts yet | 2s | 512 MB | Judgeable |
| GravityApples fall straight down until they rest on obstacles or the floor; print the final grid. | Medium4 | SimulationImplementation | No attempts yet | 1s | 512 MB | Judgeable |
| Hidden PalindromeGiven a word of at most 40 lowercase letters, find the longest palindromic subsequence obtainable by deleting letters from the front and back. | Medium4 | Dynamic programmingString+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | SimulationImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Tandem BicyclePair each Dmojistan rider with a Pegland rider to minimize or maximize the sum of the larger speed in each pair. | Medium4 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| TunnelGiven the entry order and exit order of N cars through a tunnel, count how many cars must have overtaken another car. | Medium4 | ArrayHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wheat HarvestFind each connected block of 1s, order blocks by area, and label every cell with its block's rank. | Medium4 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum of Divisor SumsGiven L and R, compute the sum of divisor sums f(n) for every n from L to R. | Medium4 | MathNumber theory+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Counting HaybalesGiven N distinct haybale positions and Q interval queries, count how many positions fall inside each inclusive range [A, B]. | Medium4 | SortingBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | BFSGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Box PackingGiven box sizes in order, find the longest subsequence where each box is strictly smaller than the next, counting boxes in the pile. | Medium4 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Merging SlimesMerge N slimes two at a time, scoring the product of merged sizes, and maximize the total score. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Safe Squares (Small)Count all axis-aligned D by D subgrids of an R by C grid that contain no monster cell. | Medium4 | Dynamic programmingMatrix+2 | No attempts yet | 5s | 512 MB | Judgeable |
| 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. | Medium4 | GraphTopological sort+2 | No attempts yet | 5s | 1024 MB | Judgeable |
| 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. | Medium4 | Brute forceImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| 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. | Medium4 | GreedyString+1 | No attempts yet | 5s | 512 MB | Judgeable |
| 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. | Medium4 | GreedyString+1 | No attempts yet | 5s | 512 MB | Judgeable |
| BeachCount the hexagon edges that separate land from water, ignoring any edge on the outer border of the map. | Medium4 | ImplementationMatrix+2 | No attempts yet | 2s | 512 MB | Judgeable |
| OvertimeGiven timestamped enter and leave records, count overtime as unmatched leaves plus unmatched enters per name after pairing. | Medium4 | Hash mapStack+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | Dynamic programmingMatrix+2 | No attempts yet | 2s | 256 MB | Judgeable |
| 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. | Medium4 | GreedyArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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). | Medium4 | GeometryMath | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | SimulationMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| When Geudae Becomes GeumeoGiven N characters and M replacement pairs, find the minimum number of substitutions needed to convert character a into character b. | Medium4 | GraphBFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | SimulationImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | SimulationImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | StringGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Bovine Genomics (Silver)Count triples of genome positions where no spotty cow and plain cow share the same three characters. | Medium4 | Brute forceHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | ImplementationMath | No attempts yet | 2s | 512 MB | Judgeable |
| The fastest road to BanikoaraGiven towns joined by undirected weighted roads, find the shortest travel distance between a named departure town and destination town. | Medium4 | GraphShortest path+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Additive and multiplicative inversesGiven N and A, print the additive inverse of A modulo N and the multiplicative inverse if it exists, otherwise -1. | Medium4 | Number theoryMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Prerequisite CoursesGiven prerequisite pairs between courses, find the earliest semester each course can be completed when unlimited courses may be taken per semester. | Medium4 | GraphTopological sort+2 | No attempts yet | 5s | 256 MB | Judgeable |
| 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. | Medium4 | Dynamic programmingMatrix+1 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | GreedyMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 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). | Medium4 | Shortest pathGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Frozen FoodCount the minutes from a start time to an end time, inclusive, whose HH:MM display contains the digit N at least once. | Medium4 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Need for SpeedGiven segment distances and speedometer readings plus a total time, find the constant offset c making the summed travel times equal t. | Medium4 | Binary searchMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | ArrayPrefix sum+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Stephen QuerySimulate N rounds of survival rock paper scissors and report the longest number of consecutive wins by any single player. | Medium4 | SimulationImplementation+1 | No attempts yet | 2s | 256 MB | Judgeable |
| 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. | Medium4 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 256 MB | Judgeable |
| 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. | Medium4 | SortingMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | TreeDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Venue Rental (Small)Given up to 100 axis-aligned rectangles, find the area of the union of all rectangles. | Medium4 | ArrayImplementation+2 | No attempts yet | 2s | 256 MB | Judgeable |
| 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. | Medium4 | ArrayGreedy+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | MathImplementation+2 | No attempts yet | 5s | 512 MB | Judgeable |
| 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. | Medium4 | Brute forceSorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| 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. | Medium4 | MathGeometry+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sum of all pairwise productsGiven n integers, compute the sum of x_a * x_b over all pairs with a < b. | Medium4 | MathPrefix sum+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | StringImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Forbidden ZeroGiven a positive integer n with no digit 0, find the next integer in increasing order that also contains no digit 0. | Medium4 | MathImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | MathNumber theory+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Police StationIn a directed graph, list every vertex from which all other vertices are reachable by following arrows forward. | Medium4 | GraphDFS+1 | No attempts yet | 2s | 1024 MB | Judgeable |
| 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. | Medium4 | SimulationGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Olympiad PizzaContestants queue for pizza slices; each takes one slice per turn and rejoins the back if still hungry. Report the second each finishes. | Medium4 | QueueSimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | GreedyTwo pointers+2 | No attempts yet | 4s | 512 MB | Judgeable |
| ZigZagGiven K words and N letters, output for each letter the word starting with it that has been used fewest times, breaking ties alphabetically. | Medium4 | SortingHash map+2 | No attempts yet | 2s | 64 MB | Judgeable |
| 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. | Medium4 | GreedySorting+2 | No attempts yet | 1s | 64 MB | Judgeable |
| 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. | Medium4 | GreedySorting | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | ArrayMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| 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. | Medium4 | SimulationBrute force+1 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | MathBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | SimulationGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Bovine ShuffleGiven a permutation describing one shuffle and the cow order after three shuffles, recover the original order before the shuffles. | Medium4 | ArrayImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | SimulationSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Coloring IntervalsGiven n closed intervals with distinct endpoints, find the minimum number of colors so that overlapping intervals get different colors. | Medium4 | SortingIntervals+2 | No attempts yet | 3s | 512 MB | Judgeable |
| 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. | Medium4 | ArraySimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | ImplementationBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | BacktrackingRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | BacktrackingSorting+1 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | BacktrackingRecursion+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | BacktrackingSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| OthelloGiven the sequence of moves of a valid 6x6 Othello game, replays them and prints the final board plus the winner. | Medium4 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| 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. | Medium4 | ArraySimulation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| JujisuGiven an N by M grid of populations, answer K queries for the sum of people inside each requested rectangle. | Medium4 | Prefix sumArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Counting equilateral trianglesGiven a triangular tower with N layers of unit triangles, count every equilateral triangle of any size, both upward and downward pointing. | Medium4 | MathCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Big Integer A+BRead two integers up to 10^10000 in magnitude and print their sum without using built-in big integer support. | Medium4 | ImplementationString+2 | No attempts yet | 1s | 512 MB | Judgeable |
| 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. | Medium4 | SortingGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| 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. | Medium4 | GreedyArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Lemonade LineGiven each cow's maximum tolerated queue length, choose an arrival order that minimizes how many cows end up waiting in line. | Medium4 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| SegmentationTrack visits per user over time and answer queries by mapping each user's recency and frequency to one of 12 RF segments. | Medium4 | Hash mapImplementation+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| 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. | Medium4 | ImplementationMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Aku NegarakuFor each N and M, simulate Josephus elimination around a circle and report the last remaining trainee's number. | Medium4 | SimulationArray+1 | No attempts yet | 3s | 512 MB | Judgeable |
| 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). | Medium4 | ImplementationMath+2 | No attempts yet | 1s | 32 MB | Judgeable |