Curated sets
Interview core
The mediums that show up in real onsite loops.
Total results1,547 problems
| Topics | Judge | |||||
|---|---|---|---|---|---|---|
| High-Rise BuildingsGiven the heights of N buildings in a row, find the maximum number of other buildings visible in a straight line of sight from any single building. | Medium5 | GeometryBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| CocktailGiven a tree of N ingredients linked by N-1 known mass ratios, compute the smallest positive integer masses that satisfy every ratio. | Medium5 | TreeDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| LampsGiven an N by M lamp grid where pressing a column switch exactly K times total flips columns, find the max number of rows that end up fully lit. | Medium5 | Hash mapString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| DiceGiven a die net and N, stack N^3 dice into an N x N x N cube and minimize the sum of numbers on the five visible faces. | Medium5 | ImplementationGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Lexicographically Largest SortGiven a distinct-integer array and a budget of at most S adjacent swaps, output the lexicographically largest array reachable within that swap budget. | Medium5 | GreedyArray+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Unknown SentencePartition a sentence into segments that are anagrams of given words, minimizing total letters moved from their original word positions. | Medium5 | Dynamic programmingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| HotelGiven advertising costs and customer gains for up to 20 cities with unlimited repeats, find the minimum total cost to gain at least C new customers. | Medium5 | Dynamic programmingMath | No attempts yet | 2s | 128 MB | Judgeable |
| Maximum SumAssign digits 0-9 to letters A-J that encode N numbers so that the sum of the numbers is maximized while no number has a leading zero. | Medium5 | GreedyMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| PrefixGiven up to 50 words, find the largest subset where no word is a prefix of another, using a trie and tree DP. | Medium5 | TrieDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tree DiameterGiven a weighted tree with up to 100,000 vertices, compute the diameter as the maximum distance between any two vertices. | Medium5 | TreeDFS+2 | No attempts yet | 2s | 256 MB | Judgeable |
| ExerciseSimulate a pulse that rises by T when exercising and falls by R when resting (bounded between m and M) to find the minimum minutes needed to accumulate N exercise minutes, or report impossibility. | Medium5 | GreedySimulation+1 | No attempts yet | 2s | 16 MB | Judgeable |
| PartyGiven a directed weighted graph, compute for each village the round-trip shortest time to a fixed village X and return the maximum over all villages. | Medium5 | Shortest pathGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Farm ManagementCount 8-directionally connected groups of equal-height cells in a grid where every outside neighbor is strictly lower. | Medium5 | BFSDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Good NumbersGiven N integers, count how many of them equal the sum of two other numbers at two different positions in the sequence. | Medium5 | Two pointersArray+1 | No attempts yet | 2s | 256 MB | Judgeable |
| DictionaryConstruct the K-th lexicographically smallest string made of N 'a's and M 'z's using combinatorial counting, or report -1 if K exceeds the total count. | Medium5 | CombinatoricsGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Wall-Breaking MazeFind the minimum number of walls to break on a grid path from the top-left to the bottom-right room, moving through 4 directions. | Medium5 | BFSShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| K-th NumberFind the k-th smallest value in the N x N multiplication table using binary search with a counting function. | Medium5 | Binary searchMath | No attempts yet | 2s | 128 MB | Judgeable |
| Run, HongjunGiven N billboard intensities and a sight range M, output the maximum intensity within a sliding window of size 2M-1 for each valid position. | Medium5 | Sliding windowQueue+1 | No attempts yet | 2s | 256 MB | Judgeable |
| X and KGiven X and K, find the K-th smallest positive integer Y such that X+Y equals X OR Y, which requires placing K's bits into the zero-bit positions of X. | Medium5 | Bit manipulationMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Hopping FrogFind the minimum number of jumps for a frog moving between numbered stones, where each stone's value dictates allowed jump distances as multiples. | Medium5 | BFSGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Fixed-Length Reversal SortGiven a permutation of up to 8 numbers, find the minimum number of fixed-length K reversals needed to sort it, or report impossibility. | Medium5 | BFSGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tangled Electric WiresGiven a matching between left and right poles, find the minimum number of wires to cut so no two remaining wires cross, which reduces to computing N minus the longest increasing subsequence. | Medium5 | Dynamic programmingBinary search+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Watering FieldsGiven well-digging costs per field and pairwise pipe-connection costs, compute the minimum total cost to give every field water using an MST-style approach with a virtual water source. | Medium5 | Minimum spanning treeGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Paper FoldingDecide whether a strip of N labeled cells can be folded so the stack reads 1 to N from top to bottom, checking labels against the shrinking strip's two ends. | Medium5 | Two pointersSimulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Woodcutter DasomChoose a single cut length for all logs to maximize total profit from selling equal-length pieces after subtracting per-cut costs. | Medium5 | Brute forceSimulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Sunday Morning DateFind a grid path from S to F that first minimizes the number of trash cells stepped on, then minimizes clean cells adjacent to trash along that path. | Medium5 | Shortest pathBFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| DuelMatch N Team A fighters against N Team B fighters to maximize points, where a win scores 2, a tie scores 1, and a loss scores 0. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Shortest Path Through Required VerticesGiven a weighted undirected graph, find the shortest path from vertex 1 to vertex N that must pass through two specified vertices. | Medium5 | Shortest pathGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| String ExchangeGiven a circular string of a's and b's, find the minimum number of swaps to make all a's form one consecutive block. | Medium5 | Sliding windowString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Sejun and Sebi's WarGiven two armies whose weakest soldier dies each round (ties killing Sebi's soldier first), determine which side's soldier survives last. | Medium5 | GreedySimulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Triangle SubsequenceGiven a sequence, find the longest subsequence where every triple of elements satisfies the triangle inequality. | Medium5 | SortingTwo pointers+1 | No attempts yet | 2s | 128 MB | Judgeable |
| World ConquestGiven population counts for N countries, find the maximum number of size-K groups where each group's members come from distinct countries. | Medium5 | Binary searchGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Roads of the Northern CountryGiven the edges of a weighted tree of up to 10,000 cities, compute the length of the tree's diameter (the longest path between two nodes). | Medium5 | TreeGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Counting Crossing EdgesGiven M cross edges between two labeled vertex sets of size N, count how many unordered pairs of edges cross each other. | Medium5 | SortingDivide and conquer+2 | No attempts yet | 2s | 128 MB | Judgeable |
| New Year PartyPick a maximum-score guest list from a company tree so no employee and their direct manager both attend, computed with and without the root. | Medium5 | Dynamic programmingTree+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Making the Best TeamChoose 15 players for white and 15 for black from a list of up to 1000 players to maximize the total ability sum. | Medium5 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Sungji's Birthday PartyGiven N students each requiring a minimum number of other attendees to be satisfied, find the smallest group of students that can be invited so every invited student's requirement is met. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Running MedianGiven integers one by one, output the running median (lower of the two middles when count is even) after each insertion. | Medium5 | HeapSorting+1 | No attempts yet | 0.1s | 128 MB | Judgeable |
| Captain DasomGiven N cannonballs, find the minimum number of tetrahedral-number piles whose sizes sum exactly to N using unbounded coin-change style DP. | Medium5 | Dynamic programmingMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Number GameGiven a set of numbers including 1 and a limit K, find the first integer that cannot be formed using at most K chosen numbers, then decide the game winner by turn parity. | Medium5 | Dynamic programmingMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Labels Without a Forbidden DigitGiven N and a forbidden digit L, find the N-th smallest positive integer whose decimal digits never contain L. | Medium5 | MathCombinatorics+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Making a PalindromeFind the minimum number of integers to insert into a sequence so it becomes a palindrome, using interval or LCS-based dynamic programming. | Medium5 | Dynamic programmingArray+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Power Strip SchedulingSimulate plugging devices into a strip with N outlets and, when full, evict the device whose next use is farthest away (or never used again), counting total unplugs. | Medium5 | GreedySimulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Candidate RecommendationSimulate N photo frames where each recommendation either updates a displayed student's count or evicts the least-recommended, longest-displayed student to show the new one. | Medium5 | SimulationHash map+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Number GroupingGiven N integers, decide which pairs to multiply instead of add so that the resulting total sum is maximized. | Medium5 | GreedySorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| TilingCount the number of ways to tile a 2×n rectangle using 2×1 and 2×2 tiles for multiple values of n up to 250. | Medium5 | Dynamic programmingMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Maal GatheringGiven a grid with K-Maal pieces that jump up to K knight moves per turn, find the minimum total moves to gather all pieces on one square. | Medium5 | BFSShortest path+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Balanced LineupGiven fans sorted by x-coordinate with a gender bit each, find the longest contiguous segment that has an equal number of men and women. | Medium5 | Prefix sumHash map+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Sorting the BookshelfFind the minimum number of single-book relocations needed to sort a permutation of N books into increasing order. | Medium5 | Dynamic programmingArray+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Word ExtensionGiven a dictionary and a starting 3-letter word, find the longest word reachable by repeatedly inserting one letter such that each intermediate word exists in the dictionary. | Medium5 | Dynamic programmingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Lexicographically Smallest Valid SequenceGiven a permutation S, construct the lexicographically smallest permutation T where each element differs from the corresponding S element by at most 1. | Medium5 | GreedyArray | No attempts yet | 1s | 128 MB | Judgeable |
| Stacking BoxesSimulate stacking N axis-aligned boxes at given footprints using a 2D max-height map and report the final maximum height. | Medium5 | SimulationArray+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Coin DistributionGiven several coin denominations with counts, decide for three test cases whether the coins can be split into two subsets of equal total value. | Medium5 | Dynamic programmingArray | No attempts yet | 2s | 128 MB | Judgeable |
| Chemistry ExperimentDecide whether M mg of solution can be split into positive integer amounts per reagent so every reagent's linear gas formula a_i*x+b_i gives the same value, and output that value or 0. | Medium5 | Binary searchMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Prime PathFind the minimum number of single-digit changes to transform one four-digit prime into another, keeping every intermediate number a four-digit prime, using BFS on the graph of primes. | Medium5 | BFSGraph+1 | No attempts yet | 2s | 256 MB | Judgeable |
| CheersGiven N people around a circle each drinking a cola brand, find the maximum number of non-crossing pairs connecting people with the same brand. | Medium5 | Dynamic programmingIntervals | No attempts yet | 2s | 128 MB | Judgeable |
| Safe Squares on a ChessboardGiven a chessboard with queens, knights, and pawns, count squares that no queen or knight attacks, treating all pieces as movement blockers. | Medium5 | SimulationImplementation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Products of PrimesFind the N-th smallest number that can be formed as a product of one or more (with repetition) of K given distinct primes, using a heap-based merge. | Medium5 | HeapMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Minimum Transfer RouteGiven several subway lines as sequences of stations, compute the minimum number of transfers to travel between two given stations using BFS over lines. | Medium5 | BFSGraph+1 | No attempts yet | 1s | 256 MB | Judgeable |
| SemitoneGiven a sequence of semitone moves, determine which of the 7 white-key starting notes keep every intermediate step on a white key and report each valid start/end note pair. | Medium5 | SimulationImplementation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| OmokSimulate placing stones in given order on a 19x19 Gomoku board and find the first move that creates exactly 5 in a row (not 6+) for its color. | Medium5 | SimulationImplementation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Bug on a TreeGiven a tree with fruit values on vertices, find the maximum sum path (simple path) and its smallest-numbered starting endpoint. | Medium5 | TreeDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| AntsSimulate ants that reverse on collision by treating collisions as pass-throughs, then track identities to find which numbered ant falls off last and when. | Medium5 | SimulationMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Bulbs and SwitchesGiven current and target bulb states, determine the minimum number of switch presses (each flipping a small neighborhood) needed, or -1 if impossible. | Medium5 | GreedySimulation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Building a BridgeGiven a grid of land and sea, find the shortest straight sea-cell bridge connecting two different islands. | Medium5 | BFSArray+1 | No attempts yet | 2s | 192 MB | Judgeable |
| Wine TastingPick numbers from a sequence maximizing sum while never selecting three consecutive elements. | Medium5 | Dynamic programming | No attempts yet | 2s | 128 MB | Judgeable |
| In-Flight Meal TripFind the maximum-score path from city 1 to city N using at most M cities, moving only to strictly increasing city numbers along available flights. | Medium5 | Dynamic programmingGraph | No attempts yet | 2s | 128 MB | Judgeable |
| Similar WordsGiven up to 20,000 distinct words, find the pair with the longest common prefix, breaking ties by input order. | Medium5 | StringSorting+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Field Mouse EscapeGiven mouse and tunnel coordinates plus a max travel distance, compute the minimum number of mice that cannot be matched to a distinct tunnel using bipartite matching. | Medium5 | GraphGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Move by Breaking One WallFind the shortest path in a grid from top-left to bottom-right where you may break at most one wall along the way. | Medium5 | BFSGraph+1 | No attempts yet | 2s | 192 MB | Judgeable |
| Checking CausalityGiven send/receive events across computers with local clocks, detect whether the induced ordering constraints form a cycle indicating a causality violation. | Medium5 | GraphTopological sort+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Team FormationPartition an age-ordered score sequence into contiguous groups to maximize the sum of each group's max-minus-min score. | Medium5 | Dynamic programmingArray+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Plum TreeGiven a sequence of falling trees over T seconds, find the max plums caught starting at tree 1 with at most W moves between trees. | Medium5 | Dynamic programming | No attempts yet | 2s | 128 MB | Judgeable |
| Tree Height and WidthGiven a binary tree's parent-child structure, place nodes on a grid by binary tree layout rules and find the level with the maximum column width, breaking ties by smallest level. | Medium5 | TreeBFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Recover Tree PreorderGiven a tree's inorder and postorder sequences, reconstruct the tree and output its preorder traversal. | Medium5 | TreeRecursion+1 | No attempts yet | 5s | 128 MB | Judgeable |
| SequenceFind the K-th lexicographically smallest non-decreasing sequence of N positive integers summing to M. | Medium5 | BacktrackingCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Theater SeatsCount permutations where each ticket holder sits in their own or adjacent seat, with VIP seats fixed and splitting the row into independent segments counted by a Fibonacci-like recurrence. | Medium5 | Dynamic programmingCombinatorics+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Buying JewelsFor each of n rows pick a contiguous non-empty subarray maximizing summed total value, breaking ties by fewest jewels then lexicographically smallest index sequence. | Medium5 | Dynamic programmingArray+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Tree CuttingGiven a tree with n vertices, find the minimum number of edges to cut so some resulting piece has exactly m vertices, or report impossibility. | Medium5 | TreeDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Pipe CuttingGiven M long pipes and N required short pipe lengths, compute the maximum number of short pipes that can be cut from the long pipes. | Medium5 | GreedySorting | No attempts yet | 2s | 128 MB | Judgeable |
| Height OrderGiven pairwise shorter-than relations between students, count how many students have their exact height rank fully determined by transitivity. | Medium5 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Three SolutionsGiven up to 5000 distinct integers, find three distinct values whose sum is closest to zero, using sorting and two-pointer scanning. | Medium5 | Two pointersSorting+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Brotherly Field DivisionChoose a non-decreasing staircase cut across N columns of an N x N grid to minimize the harvest difference between the two regions, and output one such cut. | Medium5 | Dynamic programmingBrute force+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Inequality SignsGiven a sequence of < and > signs, place k+1 distinct digits 0-9 to satisfy all comparisons and output the lexicographically largest and smallest resulting digit strings. | Medium5 | BacktrackingGreedy+1 | No attempts yet | 1s | 256 MB | Judgeable |
| ParameciaSimulate a population where each individual matures, reproduces daily within an age window, dies at a fixed age, and count survivors on day N modulo 1000. | Medium5 | Dynamic programmingSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Electric WiresGiven wires connecting positions on two poles, find the minimum removals so remaining wires never cross, equivalent to n minus the longest increasing subsequence. | Medium5 | Dynamic programmingBinary search+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Colored Paper 3Given up to 100 aligned black 10x10 squares on a 100x100 grid, find the maximum area axis-aligned all-black rectangle. | Medium5 | ArrayBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Folding a Tape MeasureSimulate folding a tape at marked positions for red, blue, then yellow dot pairs, tracking coordinate transformations and final folded length. | Medium5 | SimulationMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Crossing the Stone BridgesCount ways to match a scroll string to positions across two parallel bridge strings, alternating bridges and strictly increasing positions. | Medium5 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| Number BeadsSplit an ordered array into M contiguous groups to minimize the largest group sum, then output that value and the group sizes. | Medium5 | Binary searchGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Finding the Middle MarbleGiven pairwise heavier-than relations among N odd marbles, count marbles that must be eliminated as the possible median using transitive closure of the order. | Medium5 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Stable GroupGiven a like/dislike matrix, decide if people can be partitioned into groups (size at least 2) where members like each other within groups and dislike each other across groups, and output that partition. | Medium5 | Union-findGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Making a MazeFind the minimum number of black cells to convert to white so a path exists from top-left to bottom-right of an n x n grid, using 0-1 BFS or Dijkstra. | Medium5 | BFSShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Glass BallsGiven B balls and M floors, compute the minimum number of drops needed to guarantee finding the critical breaking floor in the worst case. | Medium5 | Dynamic programmingMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Running MediansGiven a sequence read one number at a time, output the running median every time an odd number of elements have been read. | Medium5 | HeapImplementation | No attempts yet | 1s | 128 MB | Judgeable |
| Cup HolderGiven a seat row with regular seats and adjacent couple-seat pairs that lack a middle cup holder, compute the maximum number of people who can access a cup holder, matching people to holders one per holder. | Medium5 | GreedyString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Dongjun's GameGiven N level scores, find the minimum total decrease needed to make the sequence strictly increasing while all scores stay positive. | Medium5 | GreedyArray+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Observing Two StarsGiven start times and periods of two blinking stars, find the earliest simultaneous blink time and weekday, or report it never happens. | Medium5 | Number theoryMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Trimming StringsFind how many top rows can be removed one at a time from a grid while all column strings (read top to bottom) remain pairwise distinct. | Medium5 | Binary searchString+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Array Not Divisible by ThreeRearrange an array so no two adjacent elements sum to a multiple of 3, or report impossibility. | Medium5 | GreedyMath+1 | No attempts yet | 1s | 128 MB | Judgeable |