Curated sets

Interview core

The mediums that show up in real onsite loops.

All problems
Total results1,547 problems
TopicsJudge
The Die Is CastRead a pixel image, split non-background pixels into dice connected by shared edges, count the dot regions inside each die, and print the counts sorted.Medium5GraphDFS+2No attempts yet1s128 MBJudgeable
Spiderman's WorkoutAssign plus or minus signs to the distances so the partial sums stay at or above 0 and return to 0 at the end, minimizing the peak height.Medium5Dynamic programmingGreedy+2No attempts yet1s128 MBJudgeable
Tournament RankingGiven game results between teams, produce the lexicographically smallest topological order, or report that no valid ranking exists due to a cycle.Medium5GraphTopological sort+2No attempts yet1s128 MBJudgeable
Traffic PlanningGiven a directed graph and a start node, list the nodes not reachable from the start by a path of one or more edges; print OK if none.Medium5GraphDFS+2No attempts yet1s128 MBJudgeable
Median Weight BeadGiven weighted comparisons between beads, count how many beads cannot be the median because at least (N+1)/2 beads are known heavier or lighter.Medium5GraphDFS+2No attempts yet1s128 MBJudgeable
Alice Through the Looking GlassGiven a magnification level and a cell coordinate, decide whether that cell of the 5^m by 5^m self-similar grid is filled or empty.Medium5RecursionDivide and conquer+1No attempts yet2s512 MBJudgeable
Putnam Rank RangeGiven the average rank for each distinct score, find the rank range occupied by the block of contestants holding your score.Medium5MathImplementationNo attempts yet2s512 MBJudgeable
Spies Like UsGiven a bipartite graph, decide whether any two vertices on the same side share at most one common neighbor on the other side.Medium5GraphHash map+2No attempts yet2s512 MBJudgeable
Barking Dogs!Given dogs with wake-up delays and a directed hearing graph, simulate who barks each second from 0 to T and count each dog's barks.Medium5SimulationGraph+2No attempts yet2s512 MBJudgeable
ShuffleGiven a permutation of 27 characters, apply it N times to a short string and print the result.Medium5ImplementationMath+2No attempts yet2s512 MBJudgeable
CN TowerGiven angles of landmarks around a rotating restaurant that turns 360 degrees every 72 minutes, find the shortest time window covering all distinct angles.Medium5SortingTwo pointers+2No attempts yet1s128 MBJudgeable
BananasDecide for each word whether it fits the recursive grammar of a monkey language, where words wrap other words in N and in B...S.Medium5StringRecursion+2No attempts yet1s128 MBJudgeable
Pinball RankingGiven scores in play order, compute each game's rank as one plus the number of earlier-or-later scores strictly above it, then output the average rank as a reduced fraction.Medium5Binary searchSorting+2No attempts yet1s128 MBJudgeable
SpreadsheetEvaluate each spreadsheet cell, treating formula cells as sums of other cells, and mark any cell involved in a dependency cycle as undefined.Medium5GraphDFS+2No attempts yet1s128 MBJudgeable
ScribbleGiven seven tiles with letter values and a dictionary of up to 100000 words, find the highest-scoring dictionary word formable from the tiles, or 0 if none is.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
CookiesGiven up to 10 points, find the diameter of the smallest enclosing circle.Medium5GeometryBrute force+2No attempts yet1s128 MBJudgeable
SubsetsGiven inequalities where a set name contains either an element or another set name, find each named set's minimal required elements.Medium5GraphDFS+2No attempts yet1s128 MBJudgeable
Pattern GeneratorFor each (n, k) pair, print all n-bit strings with exactly k ones in decreasing numeric order, separated by blank lines.Medium5BacktrackingRecursion+2No attempts yet1s128 MBJudgeable
All Roads Lead Where?Given a tree of cities rooted at Rome and query pairs, print the unique shortest path between each pair as the first letters of the cities on the route.Medium5TreeDFS+2No attempts yet1s128 MBJudgeable
Tree CuttingOn a tree of N nodes, print every node whose removal leaves each connected piece with at most floor(N/2) nodes, or NONE.Medium5TreeDFS+2No attempts yet1s128 MBJudgeable
Journey of a KnightGiven an n by m board, find the minimum number of knight moves from cell (1,1) to cell (i,j), or report that it is unreachable.Medium5BFSGraph+2No attempts yet1s128 MBJudgeable
GearsCount how many distinct fractions a/b exist with both a and b in the range M to N.Medium5MathNumber theory+2No attempts yet1s1024 MBJudgeable
Tax SystemEach client's income is taxed through N progressive brackets with given widths and rates; compute the total tax for M clients, printed to two decimals.Medium5Prefix sumBinary search+2No attempts yet1s1024 MBJudgeable
MõttemeisterGiven several guesses and their correct-digit counts A and position counts B, list every 4-digit secret number consistent with all clues.Medium5Brute forceImplementation+2No attempts yet1s1024 MBJudgeable
TähekabeOn an N x N letter grid, decide for each of up to 10 query words whether a simple path from the start cell spells it, without reusing a cell.Medium5BacktrackingDFS+2No attempts yet1s1024 MBJudgeable
Go-KartFind the smallest fuel-tank capacity that lets a kart refuel at given stations and travel at least K kilometers.Medium5Binary searchGreedy+1No attempts yet1s1024 MBJudgeable
Sawtooth SequenceGiven N distinct numbers, arrange all of them into a zigzag sequence and output the lexicographically smallest such arrangement.Medium5GreedySorting+2No attempts yet1s1024 MBJudgeable
AnimalsGiven N daily active intervals, some crossing midnight, find whether all overlap at some moment and output the longest common sub-interval.Medium5IntervalsImplementation+2No attempts yet1s1024 MBJudgeable
CourierSimulate orders arriving over time: assign each to the free courier who delivers fastest, or drop it if all couriers are busy, and total each courier's earnings.Medium5SimulationImplementation+2No attempts yet1s1024 MBJudgeable
ChocolateGiven an M by N grid of labels, decide whether every label occupies exactly one solid axis-aligned rectangle.Medium5MatrixImplementation+1No attempts yet1s1024 MBJudgeable
Spacecraft MalfunctionGiven each unit's check reports on two others, exactly one faulty unit, and a faulty unit may lie, find the unique faulty unit or print impossible.Medium5Brute forceImplementation+2No attempts yet1s128 MBJudgeable
Parentheses Encoding ConversionGiven the P-sequence encoding of a well-formed parenthesis string, compute its W-sequence encoding.Medium5StackSimulation+1No attempts yet1s128 MBJudgeable
Space AntGiven N points with distinct x and y coordinates, output the order produced by repeatedly picking the most clockwise remaining point from the current one.Medium5GeometrySorting+2No attempts yet1s128 MBJudgeable
Wooden SticksGiven n sticks with length and weight, order them to minimize the number of setup steps, where a setup is needed unless both length and weight are nondecreasing from the previous stick.Medium5SortingGreedy+1No attempts yet1s128 MBJudgeable
Repeated Permutation CipherGiven a permutation key and a repeat count k, apply the permutation to each padded message k times and print the result.Medium5ArrayImplementation+2No attempts yet1s128 MBJudgeable
Card Game CheaterEve knows Adam's card order and must permute her own cards to maximize the number of positions where her card beats his.Medium5GreedySorting+2No attempts yet1s128 MBJudgeable
InvestmentStarting capital grows over at most 40 years by rebuying a portfolio of bonds each year; maximize the final amount.Medium5Dynamic programmingGreedyNo attempts yet1s128 MBJudgeable
GunmanEach window is a rectangle at a distinct depth; decide whether one straight ray fired from the X axis can pass through all of them.Medium5GeometryBinary search+2No attempts yet2s128 MBJudgeable
DivisibilityGiven a sequence and a modulus K, decide whether some choice of + or - before each later element makes the total divisible by K.Medium5Dynamic programmingMath+2No attempts yet1s128 MBJudgeable
False CoinGiven recorded balance weighings of N coins with exactly one false coin, output the coin number if the results identify it uniquely, otherwise 0.Medium5Brute forceImplementation+2No attempts yet1s128 MBJudgeable
Spell CheckerGiven a dictionary and query words, mark each query correct, or list dictionary words reachable by one deletion, replacement, or insertion.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
Bin PackingPack items into identical bins holding at most two items each so that the number of bins is minimized.Medium5GreedyTwo pointers+2No attempts yet1s128 MBJudgeable
DancersRepeatedly pair the two closest unpaired dancers, breaking ties by smaller indices, and output all pairs sorted.Medium5SortingGeometry+2No attempts yet1s128 MBJudgeable
Playground HideoutGiven a directed graph with weighted edges and direct ground costs per node, find the index of the node with the largest shortest-path distance from ground, breaking ties by smallest index.Medium5Shortest pathGraph+2No attempts yet1s128 MBJudgeable
Olympic GamesGiven each event's date and start and end times in hhmm, find the maximum number of events a person can attend without overlap, moving freely between venues.Medium5GreedySorting+2No attempts yet2s256 MBJudgeable
RelocationSplit up to 10 furniture items between two cars with capacity limits so that every item gets moved in the fewest number of paired trips.Medium5Dynamic programmingBinary search+2No attempts yet1s128 MBJudgeable
Number TricksFor each query, count the trailing zeros of n! in base b by factoring b and finding the minimum over primes of each exponent's count in n!.Medium5Number theoryMath+2No attempts yet1s128 MBJudgeable
Betting SetsPartition an N by M table of probabilities into groups of one cell per column to maximize the expected number of all-heads groups.Medium5Dynamic programmingBit manipulation+2No attempts yet1s128 MBJudgeable
Polling StationsGiven an undirected graph, find the smallest set of vertices such that every edge touches at least one chosen vertex.Medium5GraphGreedyNo attempts yet1s64 MBJudgeable
Deepest StationGiven a surface point (x, y) and depth d, decide whether a single 45-degree staircase reaches (0,0,d), it is impossible, or print the shallowest intermediate lobby.Medium5GeometryMath+1No attempts yet1s128 MBJudgeable
OutletsGiven power strips that swap between standard A and B outlets, find the maximum number of standard-A outlets that can end up powering computers.Medium5GreedySorting+2No attempts yet1s128 MBJudgeable
Digit Sum Over a RangeGiven l and u up to 2e9, find the total of the digit sums of every integer in that inclusive range.Medium5MathDynamic programming+2No attempts yet1s128 MBJudgeable
Avoiding Financial NightmareGiven a loan principal, a term in months, and a monthly interest rate, find the fixed monthly payment so the balance hits zero at term end.Medium5Binary searchSimulation+2No attempts yet1s128 MBJudgeable
No Pause TelegraphGiven a string of dots and dashes and seven fixed letter codes, split it into codewords that minimize the resulting message alphabetically, or report that no split exists.Medium5Dynamic programmingString+2No attempts yet1s128 MBJudgeable
Romantic DateGiven Wibowo's 26 cards, find the maximum number of rounds he can win by pairing his cards against his opponent's 26 cards in the best order.Medium5GreedySorting+1No attempts yet1s128 MBJudgeable
Nearest number - 2Replace each zero with the nearest nonzero value using Manhattan distance, but leave zeros that are tied between two or more nearest values unchanged.Medium5BFSGraph+2No attempts yet1s128 MBJudgeable
PearlsGiven demand and price per pearl for classes in increasing quality order, find the cheapest way to buy all pearls when each class's order may be upgraded to a higher class, paying 10 extra pearls' worth per purchase.Medium5Dynamic programmingPrefix sum+1No attempts yet1s128 MBJudgeable
Cash DispenserCount 4-digit PINs whose digits appear as a subsequence of every recorded finger-movement sequence.Medium5StringDynamic programming+1No attempts yet3s128 MBJudgeable
Piggy BanksEach key i sits in some bank; opening a bank frees its keys. Find the minimum number of banks to smash to reach all N banks.Medium5GraphDFS+2No attempts yet3s128 MBJudgeable
InsulatorGiven n positive coefficients, reorder them so that the sum plus the total of positive rises between adjacent layers is as large as possible, and print that maximum.Medium5GreedySorting+2No attempts yet1s128 MBJudgeable
ProtocolsCount the length-m strings over k symbols with no run of l equal symbols, then output floor((n/m) * log2(count)).Medium5Dynamic programmingCombinatorics+2No attempts yet3s128 MBJudgeable
BalanceGiven weights, split some into two equal-sum disjoint groups; find the largest weight that can be the heaviest used one.Medium5Dynamic programmingSorting+2No attempts yet3s128 MBJudgeable
RepetitionsGiven up to five lowercase words of length at most 2000, find the length of the longest substring that appears as a contiguous fragment in every word.Medium5StringBinary search+2No attempts yet3s128 MBJudgeable
PromotionEach day, receipts are added to a box, then the largest and smallest are removed and the difference is paid out; find the total payout.Medium5HeapImplementation+2No attempts yet1s128 MBJudgeable
Monochromatic TrianglesGiven n points and a list of red edges (all other pairs are black), count the triangles whose three sides share one color.Medium5CombinatoricsGraph+2No attempts yet1s128 MBJudgeable
OrienteeringGiven the cyclic sequence of stage difficulties around a loop, decide whether some starting point and direction make the difficulties non-increasing.Medium5ArrayGreedy+1No attempts yet1s128 MBJudgeable
Logarithmic PaprikaGiven counts of paprika weighing 1, 2, 4, ..., 2^k grams, find the smallest positive weight that cannot be formed from whole pieces.Medium5GreedyMath+2No attempts yet1s128 MBJudgeable
Apples and Apple TreesGiven positions of n trees and m apples on a line, find the minimum distance from any apple to its nearest tree.Medium5SortingBinary search+2No attempts yet1s128 MBJudgeable
LibraryMerge n files two at a time, where each merge costs the sum of the two lengths, and minimize the total cost.Medium5GreedyHeapNo attempts yet1s128 MBJudgeable
Crime at Piccadilly CircusFor each integer moment in [p, k], count how many people's inclusive intervals cover it, and report the minimum and maximum counts.Medium5IntervalsSorting+2No attempts yet1s128 MBJudgeable
Galactic Container ShipGiven M rails with height limits 1..M and N plates each worth its quality w and having height h, choose plates to maximize total quality so that each chosen plate fits some distinct rail.Medium5GreedySorting+1No attempts yet1s128 MBJudgeable
HighwaysFind a spanning tree of a connected weighted graph that minimizes the maximum edge weight, and report that weight.Medium5Minimum spanning treeGraph+2No attempts yet1s128 MBJudgeable
Two WordsAfter each swap of one character between the two strings, report which string is lexicographically larger.Medium5Segment treeStringNo attempts yet1s512 MBJudgeable
The TravelerCompute the height and width of the smallest axis-aligned rectangle containing a walk given in repeated direction blocks.Medium5SimulationPrefix sum+1No attempts yet1s512 MBJudgeable
ButtonsSimulate single counter increments and global max-fill operations to find the final counter values.Medium5SimulationArrayNo attempts yet1s512 MBJudgeable
MatchesFlip the fewest matches in a row so fire lit at the left end spreads through every neighboring pair.Medium5Dynamic programmingPrefix sumNo attempts yet1s512 MBJudgeable
BrothersChoose the largest set of families whose position spans never overlap so each kept family stands together.Medium5GreedyIntervals+1No attempts yet1s512 MBJudgeable
MerchantBuy in one city and sell in another along a line to maximize selling price minus buying price minus travel cost.Medium5GreedyPrefix sumNo attempts yet1s512 MBJudgeable
Car WorkshopsCars pass through workshops in order and each one repaints color a to b on a match, so compute every final color.Medium5SimulationArrayNo attempts yet1s512 MBJudgeable
Chemical ReactionsCount unowned compounds that become producible by repeatedly firing reactions whose substrates are all available.Medium5BFSGraph+1No attempts yet1s512 MBJudgeable
DistanceChoose two array elements, possibly the same element twice, to maximize the sum of the two values plus the distance between their positions.Medium5GreedyArrayNo attempts yet1s128 MBJudgeable
CitiesCount for each city on a directed line how many other cities are reachable through one-way and two-way roads.Medium5ArrayPrefix sumNo attempts yet1s128 MBJudgeable
Balls in a Binary TreeFollow the n-th ball down h levels of toggling switches, going left on odd visits and right on even visits, to find its leaf number.Medium5Bit manipulationSimulation+1No attempts yet1s128 MBJudgeable
ChildrenGiven a permutation on n cells, find the fewest adjacent swaps so every walk visits all cells.Medium5GraphArrayNo attempts yet1s128 MBJudgeable
Raffle TicketsBuy tickets from baskets with known winning and losing counts to guarantee at least g wins with the fewest tickets.Medium5Dynamic programmingNo attempts yet1s128 MBJudgeable
Traffic LanesFind the fewest lane changes needed to drive across an n by m grid of blocked and free cells, starting and ending in any lane.Medium5Shortest pathBFS+1No attempts yet1s128 MBJudgeable
Paper StripFind the longest contiguous block of numbers that adds up to exactly s, or print BRAK when none exists.Medium5Hash mapPrefix sumNo attempts yet1s128 MBJudgeable
RadiotelegraphGiven n integers and at most w changes to any values, find the longest run of equal numbers achievable.Medium5Sliding windowHash mapNo attempts yet1s128 MBJudgeable
Planting PotatoesDistribute up to m potatoes over fields capped at b_i so the sum of squared counts is as large as possible.Medium5GreedySortingNo attempts yet1s128 MBJudgeable
Equalizing Water in GlassesGiven the water levels in n adjacent glasses, find the fewest pours between neighbors that make all levels equal.Medium5GreedyPrefix sumNo attempts yet1s128 MBJudgeable
Chinese RestaurantsPick the intersection that minimizes the farthest distance to a marked restaurant and report that distance, or -1 when no restaurant exists.Medium5TreeBFSNo attempts yet1s128 MBJudgeable
The BoardFind the longest string of zeros followed by ones that appears as a subsequence of both given binary sequences.Medium5GreedyTwo pointers+1No attempts yet1s128 MBJudgeable
TowerEach resident climbs the steps from the bottom and stops before the first step whose height reaches their own.Medium5Binary searchPrefix sumNo attempts yet1s128 MBJudgeable
Paper RollsSet every roll to one shared unrolled length within each total length using the fewest 1-cm moves.Medium5SortingMathNo attempts yet1s128 MBJudgeable
ForestFind the smallest possible oldest-tree age among all edge-connected groups of exactly d trees in an n by n age grid.Medium5Binary searchBFS+1No attempts yet1s128 MBJudgeable
Binary SumGiven k, print in binary the sum of all integers from 1 to the largest k-digit binary number.Medium5MathBit manipulationNo attempts yet1s128 MBJudgeable
BubuFind Bubu's fastest route to clearing 1 that reaches every clearing before any ranger does, or report -1.Medium5Shortest pathGraphNo attempts yet1s128 MBJudgeable
The CrossingPair at most two riders per shared boat within the weight limit or send each alone, and find the lowest total fare.Medium5GreedySorting+1No attempts yet2s128 MBJudgeable
WatchtowersFind the maximum sum over any nonempty block of consecutive towers arranged in a circle.Medium5Dynamic programmingArrayNo attempts yet1s128 MBJudgeable
Neighborhood RivalryEach cell of the grid needs the maximum value inside the square of radius R centered on it.Medium5Sliding windowMatrix+1No attempts yet2.5s128 MBJudgeable