Curated sets

Interview core

The mediums that show up in real onsite loops.

All problems
Total results1,547 problems
TopicsJudge
Word SearchGiven N database words compared in order against a query using character-by-character matching that also checks for word-end, compute total comparisons per query.Medium5TrieString+1No attempts yet1s128 MBJudgeable
Concert Rest ScheduleSchedule N members' fixed-length rest intervals within a T-minute concert so that at most two intervals overlap at any moment.Medium5GreedyIntervals+1No attempts yet1s128 MBJudgeable
Counting Axis-Aligned Right TrianglesCount triangles among N points where the right angle vertex has one point sharing its x-coordinate and another sharing its y-coordinate.Medium5Hash mapMath+1No attempts yet1s128 MBJudgeable
TennisValidate whether recorded tennis set scores form a legal best-of-three match, with a special rule that one named player never loses a set.Medium5SimulationImplementation+1No attempts yet1s128 MBJudgeable
Non-Intersecting CirclesGiven N circles centered on the x-axis, find the minimum number to remove so no two remaining circles overlap, essentially an interval scheduling problem.Medium5GreedyIntervals+1No attempts yet1s128 MBJudgeable
Beacon NetworkSimulate beacons that light up over time and archers who shoot arrows down a fixed priority list toward unlit targets, computing each beacon's lighting time.Medium5SimulationHeap+1No attempts yet1s128 MBJudgeable
Sangbeom's Secret MessageGiven a Vigenere-style encrypted message and a known substring of the plaintext, deduce the repeating key and decrypt the full message.Medium5StringBrute force+1No attempts yet1s128 MBJudgeable
Sidewalk PillarsGiven a sidewalk string and up to N extra pillars, place pillars in free segments to minimize the count of length-L parking spots, breaking ties by using fewest pillars.Medium5GreedyString+1No attempts yet1s128 MBJudgeable
Tomo's CalculatorGiven a calculator that repeatedly multiplies by B starting from A*B, find how many presses of '=' are needed until the displayed number ends with a given suffix C, or report impossible.Medium5MathSimulation+1No attempts yet1s128 MBJudgeable
Cinema InvitationGiven each friend's minimum required number of other attending friends, find the smallest subset size satisfying everyone invited's threshold.Medium5GreedySorting+1No attempts yet1s128 MBJudgeable
Restoring a Scrambled EmailGiven a scrambled string formed by replacing '@' with 'at' and optionally inserting 'nospam' once, output all distinct valid email addresses that could produce it.Medium5StringBrute force+1No attempts yet1s128 MBJudgeable
JANICAReconstruct running leader times from cumulative differences over two ski rounds to find the top three finishers by total time.Medium5SimulationSorting+1No attempts yet1s128 MBJudgeable
TramFind the minimum number of switch changes needed to travel from intersection A to B in a directed graph where each node's first listed edge is free and others cost 1, using shortest-path with 0/1 edge weights.Medium5Shortest pathGraph+1No attempts yet1s128 MBJudgeable
21 Rolls of GimbapSimulate a Connect Four style game on a 6x7 board from 21 alternating moves and report who first got four in a row and on which of their throws.Medium5SimulationMatrix+1No attempts yet1s128 MBJudgeable
AirplaneSimulate passengers walking down a single aisle to their assigned row and taking 5 seconds to load luggage, blocked by others ahead, to find total boarding time.Medium5SimulationQueue+1No attempts yet1s128 MBJudgeable
Foot TypingGiven two words and their interleaving, output the lexicographically smallest sequence of 1s and 2s marking which word produced each character.Medium5Dynamic programmingString+1No attempts yet1s128 MBJudgeable
CardsSimulate a card-sorting game to find which numbers remain consistent with a sequence of column answers after repeated row/column reshuffling.Medium5SimulationMathNo attempts yet1s128 MBJudgeable
T9Simulate a T9 keypad predictor that maps key-press sequences to dictionary words, splitting on key 1 as space and marking unmatched words with asterisks.Medium5StringHash map+1No attempts yet1s128 MBJudgeable
Popularity ListReconstruct the lexicographically smallest previous week's ranking consistent with UP/DOWN/SAME movement marks of this week's list.Medium5GreedyArray+1No attempts yet1s128 MBJudgeable
PINCount pairs of 4-character PINs (from a given list) that differ in exactly D of their four positions.Medium5Hash mapCombinatorics+1No attempts yet1s128 MBJudgeable
Matching BinsGiven a sequence of bin sizes, find the largest K such that the first K bins can each be matched to a distinct larger bin among the following K bins.Medium5Binary searchGreedy+1No attempts yet1s128 MBJudgeable
CoinDetermine the fake coin among 12 and whether it is heavier or lighter, given three balance weighing results, or report impossible/indefinite.Medium5Brute forceSimulation+1No attempts yet1s128 MBJudgeable
LinkerGiven modules with export/import tables and an entry symbol, find the reachable non-redundant modules, duplicate exports used by them, and unresolved imports.Medium5GraphBFS+1No attempts yet1s128 MBJudgeable
GemsGiven a tree, assign positive integer prices to vertices so adjacent vertices differ, minimizing total sum, essentially a greedy coloring based on tree structure.Medium5TreeGreedy+1No attempts yet1s128 MBJudgeable
Play on WordsDetermine whether all given words can be chained into one sequence where each word's first letter matches the previous word's last letter, using Eulerian path conditions on a letter graph.Medium5GraphUnion-find+1No attempts yet1s256 MBJudgeable
Kingdom RoadmapGiven a tree, compute the minimum number of extra edges needed so the graph stays connected after any single edge removal, which equals the number of leaves divided by two, rounded up.Medium5TreeGraph+1No attempts yet2s128 MBJudgeable
DatabaseDetect whether any two rows in a table share equal values in two distinct columns, and if so output the lexicographically smallest violating row and column pair.Medium5Brute forceHash map+1No attempts yet1s128 MBJudgeable
EquationEvaluate a postfix expression containing at most one occurrence of variable X as a linear function a*x+b, then solve a*x+b=0 for x as a reduced fraction, handling no-solution and infinite-solution cases.Medium5StackMath+1No attempts yet1s128 MBJudgeable
i18nGiven text lines, expand i18n-style abbreviations back into previously seen full words when the expansion is valid and unique, preserving capitalization and separators.Medium5StringHash map+1No attempts yet1s128 MBJudgeable
DryingGiven drying times per cloth that decrease by 1 each minute (or by k for one chosen cloth per minute on a radiator), find the minimum total minutes to dry all clothes, solved via binary search on time.Medium5Binary searchGreedyNo attempts yet2s64 MBJudgeable
GodfatherGiven an undirected tree, find all vertices that minimize the largest connected component size after removal (the tree centroid(s)).Medium5TreeDFS+1No attempts yet2s64 MBJudgeable
Horn ClausesParse Horn clause formulas and decide satisfiability by computing the minimal true-variable assignment via forward chaining, or report unsatisfiable.Medium5GraphImplementation+1No attempts yet2s64 MBJudgeable
L PuzzleDetermine whether a black/white grid pattern can be exactly tiled by L-shaped pieces, each with one black corner cell and two adjacent white cells.Medium5GreedySimulation+1No attempts yet5s128 MBJudgeable
The Stable Marriage ProblemGiven male and female preference lists, compute and output the male-optimal stable matching using the Gale-Shapley algorithm.Medium5GreedySimulation+1No attempts yet1s128 MBJudgeable
Router Placement to Minimize Maximum TTLGiven a tree, pick the vertex that minimizes the largest distance to any other vertex, and output that minimum maximum distance (the tree's radius).Medium5TreeGraph+2No attempts yet1s128 MBJudgeable
CounterattackTwo strikers advance in lockstep through n points, each step either dribbling or passing to the partner; find the cheapest route from a long pass at point 1 to a shot at point n.Medium5Dynamic programmingArray+1No attempts yet1s256 MBJudgeable
Voyager 1From a starting cell, fire a beam in each of four directions through mirrors / and \, black holes C, and empty cells, and report which direction survives longest or detect an infinite loop.Medium5SimulationImplementation+2No attempts yet1s128 MBJudgeable
BalloonsAllocate balloons from two rooms to teams with given distances so total delivery distance is minimized.Medium5GreedySortingNo attempts yet1s128 MBJudgeable
PalindrometerGiven an odometer reading with fixed digit positions, find the smallest number of kilometers to drive until it reads as a palindrome, counting leading zeros.Medium5StringMath+2No attempts yet1s128 MBJudgeable
Bridges and TunnelsAfter each new edge between two named buildings, print the size of the connected component that the edge joins.Medium5Union-findHash map+2No attempts yet3s128 MBJudgeable
Frosh WeekGiven n distinct student numbers in a line, find the minimum number of adjacent swaps needed to sort them into increasing order.Medium5SortingDivide and conquer+2No attempts yet1s128 MBJudgeable
Cantor SetGiven a decimal x between 0 and 1 that ends within 6 fractional digits, decide whether x lies in the Cantor set, that is, whether some ternary expansion of x avoids the digit 1.Medium5MathNumber theory+2No attempts yet1s128 MBJudgeable
Logo 2One numeric argument in a turtle graphics program is missing; find the value that makes the turtle return to its starting point.Medium5GeometryMath+2No attempts yet1s128 MBJudgeable
Team RankingsGiven up to 100 rankings of five teams, find the ranking minimizing the sum of pairwise-order disagreements, breaking ties alphabetically.Medium5Brute forceCombinatorics+2No attempts yet1s128 MBJudgeable
Chat RoomsFor each submitted line, decide accept or reject using consonant-run length, the count of recent suspicious lines, and recent duplicate counts over a sliding window of the last 10 lines.Medium5Sliding windowString+2No attempts yet1s128 MBJudgeable
Bungee JumpingGiven rope stiffness k, rest length l, bridge height s, and weight w, decide whether Bond gets stuck in the air, dies on impact, or lands safely using energy conservation. Multiple test cases until four zeros.Medium5MathSimulation+1No attempts yet1s128 MBJudgeable
Evil Straw Warts LiveFor each string, find the fewest adjacent swaps needed to rearrange it into a palindrome, or report that no palindrome is possible.Medium5GreedyTwo pointers+2No attempts yet1s128 MBJudgeable
Ferry Loading IIGiven car arrival times, ferry capacity n, and one-way time t, find the earliest finish time and the fewest one-way crossings to move all cars.Medium5GreedyImplementation+2No attempts yet1s128 MBJudgeable
CoprimeFor each n up to 1e9, count how many positive integers less than n share no common factor with n, handling several test cases until a 0.Medium5Number theoryMath+1No attempts yet1s128 MBJudgeable
Multiplication GameAlice and Bob multiply a running product by 2 to 9 in turn; find who forces the product to reach n first with optimal play.Medium5Game theoryDynamic programming+1No attempts yet1s128 MBJudgeable
A Multiple Made Only of OnesGiven n not divisible by 2 or 5, find the number of digits of the smallest repunit (all ones) that n divides.Medium5Number theoryMath+2No attempts yet1s128 MBJudgeable
Tight WordsCount words of length n over digits 0..k where adjacent digits differ by at most 1, then print that count as a percentage rounded to five decimals.Medium5Dynamic programmingCombinatorics+2No attempts yet1s128 MBJudgeable
Splitting Teams FairlySplit N people into two teams differing in size by at most one so their total weight difference is minimized, then print both totals in increasing order.Medium5Dynamic programmingArray+2No attempts yet1s128 MBJudgeable
Building the ConstellationGiven n points in the plane, connect all of them with straight segments of Euclidean length so the total cost is minimized.Medium5Minimum spanning treeGraph+2No attempts yet1s128 MBJudgeable
Games R UsGroup users into equivalence classes by identical directory access sets, then report classes of size 2 or more.Medium5Hash mapSorting+2No attempts yet1s128 MBJudgeable
FrenemiesFor each dataset, sum the signed scores of all simple paths without neutral links between a given person and every other person.Medium5DFSGraph+2No attempts yet1s128 MBJudgeable
The Extent of the ProblemSimulate RADDD's two-step defragmentation passes over disk blocks and output the final extent layout of every file.Medium5SimulationImplementation+2No attempts yet1s128 MBJudgeable
Blue JeansGiven up to 10 DNA strings of length 60, find the longest substring that appears in all of them, breaking ties alphabetically, or report none of length 3 or more.Medium5StringBrute force+2No attempts yet1s128 MBJudgeable
TypesettingPack bitmap glyphs as tightly as possible so no visible pixels from different glyphs touch horizontally, then print the result.Medium5SimulationImplementationNo attempts yet1s128 MBJudgeable
Rock SkippingFor each lake map, find the throw (start, skip distance) that maximizes count, then length, then start, then smallest distance, and print it.Medium5Brute forceImplementation+2No attempts yet1s128 MBJudgeable
Overflowing BookshelfSimulate a fixed-width shelf through add (push books leftward) and remove events; at End list the surviving books left to right.Medium5SimulationImplementation+2No attempts yet1s128 MBJudgeable
SafecrackerGiven a target T and up to 12 distinct uppercase letters, find five distinct letters whose signed power sum equals T; if several work, print the lexicographically greatest string.Medium5Brute forceBacktracking+2No attempts yet1s128 MBJudgeable
Sum It UpGiven a target and up to 12 numbers, list every distinct subset sum equal to the target, sorted in decreasing lexicographic order.Medium5BacktrackingSorting+2No attempts yet1s128 MBJudgeable
Another Puzzling ProblemEach jigsaw piece carries four integer edge labels; match opposite labels to place every piece in the N by N grid, then print the assembled picture.Medium5ImplementationBrute force+2No attempts yet1s128 MBJudgeable
Mark-up ProcessorStrip a small mark-up language from text: handle bold, italic, size, and a toggle that turns processing off, printing only the plain characters.Medium5StringSimulation+2No attempts yet1s128 MBJudgeable
The Turn of the ShrewEach child's code must differ from the bitwise OR of some male and female adult code; find the minimum Hamming distance over all pairs.Medium5Bit manipulationBrute force+2No attempts yet1s128 MBJudgeable
Reverse Roman NotationSimulate a stack calculator where operands are Roman numerals; parse and print them, and handle underflow, division by zero, and out-of-range errors.Medium5ImplementationStack+2No attempts yet1s128 MBJudgeable
The End of the WorldGiven a valid intermediate state of the Towers of Hanoi, compute how many more moves remain in the optimal solution.Medium5RecursionDivide and conquer+2No attempts yet1s128 MBJudgeable
JugglerBalls sit in a circle with one in hand; rotate either way or drop the held ball, which brings its clockwise neighbor into hand. Find the fewest moves to drop all balls in a given order.Medium5ImplementationSimulation+2No attempts yet1s128 MBJudgeable
TreesGiven an undirected graph, count its connected components that contain no cycle and report the count per test case.Medium5GraphUnion-find+2No attempts yet1s256 MBJudgeable
RailroadGiven two sequences, decide whether a target sequence can be formed by repeatedly taking the front car of either train; once one train empties, the rest follow in order.Medium5Dynamic programmingTwo pointers+2No attempts yet1s128 MBJudgeable
ShufflingGiven a fixed permutation of N cards and a target order, find the minimum number of times to apply the permutation to reach the target, or -1 if impossible.Medium5MathNumber theory+2No attempts yet1s128 MBJudgeable
PERMSFor each query (n, k), count permutations of 1..n having exactly k inversions, with n up to 18 and k up to 200.Medium5Dynamic programmingCombinatorics+2No attempts yet1s128 MBJudgeable
Sum of Squared DigitsFor two starting numbers, follow the sum-of-squared-digits map and report the smallest total length until a value appears in both sequences, or 0 if they never meet.Medium5Hash mapSimulation+2No attempts yet1s128 MBJudgeable
Analyzing Login/Logout RecordsGiven login and logout records on PCs, compute for each query how many minutes a student used at least one PC during a time interval.Medium5IntervalsSimulation+2No attempts yet1s128 MBJudgeable
Horror ListEach movie gets a level: 0 if on the horror list, else one plus the best level among similar movies; output the movie with the highest finite level, breaking ties by smallest ID.Medium5GraphBFS+2No attempts yet1s128 MBJudgeable
Robots on a GridCount monotone right/down paths from the top-left to the bottom-right of an n by n grid with blocked cells, modulo 2^31-1, and report whether the goal is reachable at all, or reachable only with up and left moves allowed.Medium5Dynamic programmingDFS+2No attempts yet1s128 MBJudgeable
lsGiven a wildcard pattern where * matches any run of characters, print the input file names that match it, keeping input order.Medium5Dynamic programmingString+2No attempts yet1s128 MBJudgeable
Royal SuccessionGiven parent pairs for N people, compute each claimant's inherited fraction of the founder's blood and print the claimant with the largest fraction.Medium5GraphDFS+2No attempts yet1s128 MBJudgeable
Playfair CipherBuild a 5x5 Playfair key table from a key phrase, split the plaintext into digraphs with X padding, and apply the row, column, or rectangle substitution rules. Output the uppercase ciphertext.Medium5SimulationMatrix+2No attempts yet1s128 MBJudgeable
ShopaholicGiven item prices, group them into triples so that the cheapest item in each triple is free, and maximize the total discount.Medium5GreedySorting+2No attempts yet1s128 MBJudgeable
ConstellationsGiven up to 500 star coordinates, connect each star to its nearest neighbor(s) and count the connected components of the resulting graph.Medium5GraphUnion-find+2No attempts yet1s128 MBJudgeable
Image SegmentationGiven an H by W color image, band each RGB value by dividing by S, then count 8-connected regions of equal band triples whose pixel size is at least L.Medium5GraphDFS+2No attempts yet1s128 MBJudgeable
Bat PositioningFind the point that equals the centroid of exactly the pointers lying at least 100 units away from it, rounding coordinates to the nearest integer.Medium5GeometryImplementation+2No attempts yet1s128 MBJudgeable
Road TripGiven a weighted tree rooted at city 1, remove exactly one non-root vertex so the round trip from city 1 covering all remaining cities is shortest, and report that length.Medium5TreeDFS+2No attempts yet1s128 MBJudgeable
Rig PlacementGiven n oil fields, a per-field investment cap m, and a total budget B, pick an investment amount for each field so total oil is maximized.Medium5Dynamic programmingArray+2No attempts yet1s128 MBJudgeable
Overlap!Given each course's exam day and time slot and each student's course list, count students who have two or more finals that overlap in time.Medium5ImplementationSorting+2No attempts yet1s128 MBJudgeable
Study DaysDistribute H study hours among n courses, each with 10 grade thresholds, to maximize the average grade point, rounded to two decimals.Medium5Dynamic programmingArray+2No attempts yet1s128 MBJudgeable
Yes or No?Pick between l and r questions to answer Yes, maximizing the sum of per-question expected correct probabilities, and report the maximum expectation to two decimals.Medium5Dynamic programmingSorting+2No attempts yet1s128 MBJudgeable
Throw a Party!!!Given friends' home regions with drunk/sober status and cars with capacity bound to regions, compute how many friends cannot be seated (each car needs a sober driver).Medium5GreedySorting+2No attempts yet1s128 MBJudgeable
Biomedical EngineeringGiven a target string and a set of reusable component strings, find the minimum number of components whose concatenation equals the target, or report that it is impossible.Medium5Dynamic programmingString+2No attempts yet1s128 MBJudgeable
GerrymanderingSplit n precincts, each with P and Q vote counts, into two nonempty districts; find how many districts P can win (0, 1, or 2).Medium5Dynamic programmingArray+2No attempts yet1s128 MBJudgeable
And the Winner IsEach ballot has one character per candidate; discard any ballot that marks more than one candidate in the same race, then report the top vote-getter (ties included) in every race, in input order.Medium5ImplementationArray+2No attempts yet1s128 MBJudgeable
SoccerCompute probability distribution of final scores after up to T seconds of a stochastic soccer simulation with passing, stealing, shooting, and absorbing states.Medium5ProbabilityDynamic programming+2No attempts yet2s128 MBJudgeable
Battleground PreservationGiven past battle results with costs, find the cheapest chain of victories between two fighters and decide the winner, or output FIGHT! if neither dominates.Medium5GraphShortest path+2No attempts yet1s128 MBJudgeable
Life ConnectionsGiven an undirected friendship graph, count the distinct shortest paths between each queried pair of nodes, where path length counts nodes.Medium5GraphBFS+2No attempts yet1s128 MBJudgeable
Pirates' PathFind the path from s to e in an undirected graph that uses the fewest guarded edges, where each edge has cost 0 or 1.Medium5GraphShortest path+2No attempts yet1s128 MBJudgeable
Decimal to FractionConvert a decimal string, with an optional repeating block in parentheses, into the exact fraction in lowest terms.Medium5MathNumber theory+2No attempts yet1s128 MBJudgeable
Jumbled LettersFor each query, find the longest dictionary word that can be formed using the query letters at most once, breaking ties alphabetically, or report IMPOSSIBLE.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
Bad WiringEach switch toggles a window of 2D+1 lights; find the fewest flips that turn every light off, or report impossibility.Medium5GreedyBit manipulationNo attempts yet3s128 MBJudgeable