Curated sets
Interview core
The mediums that show up in real onsite loops.
Total results1,547 problems
| Topics | Judge | |||||
|---|---|---|---|---|---|---|
| Gene ShuffleTwo permutations of 1..N are given; split [1,N] into the shortest pieces where each piece holds the same set of genes in both. - use plain English | Medium5 | Prefix sumHash map | No attempts yet | 1s | 128 MB | Judgeable |
| KeyloggerA log of typed keys, arrow moves, and backspaces in a text field must be replayed to recover the final password. | Medium5 | Linked listSimulation+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Stock MarketFind the contiguous subarray with the largest sum and report its 1-based start and end indices, breaking ties by smallest start then smallest end. | Medium5 | Dynamic programmingGreedy | No attempts yet | 1s | 256 MB | Judgeable |
| ImagineMaintain a 1024x1024 grid that starts as a checkerboard and process stickers plus rectangle queries for counts of each letter. | Medium5 | Prefix sumArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Venus RoverChoose which stones to collect so total value is maximized, given limits on time and total lifted mass. | Medium5 | Dynamic programming | No attempts yet | 1s | 128 MB | Judgeable |
| Olympic AvenuesGiven an undirected weighted graph with N up to 50, find the shortest path from S to F and, among ties, print the lexicographically smallest site sequence. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The ClocksGiven nine clock dials and nine moves that each rotate a fixed subset of dials by 90 degrees, find the shortest move sequence that sets every dial back to 12 o'clock. | Medium5 | Brute forceBacktracking+2 | No attempts yet | 1s | 256 MB | Judgeable |
| IOIOICount the occurrences of the alternating string P_N (N+1 I's and N O's) as a substring of S, counting overlaps. | Medium5 | StringSliding window+2 | No attempts yet | 1s | 256 MB | Judgeable |
| FashionistaFor each day pick any clothing whose temperature range covers that day's high, maximizing the sum of absolute flashiness differences between consecutive days. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| JJOOIIFind the largest k such that k J's, then k O's, then k I's appear consecutively in the given string. | Medium5 | StringPrefix sum+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Commute RouteCount monotone lattice paths from (1,1) to (w,h) that never turn at two consecutive intersections, modulo 100000. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Arranging Go StonesStones are added one by one; each even-indexed stone of a new color replaces the trailing run of the opposite color, and we count the white stones that remain. | Medium5 | StackSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Longest Common SubstringGiven two uppercase strings of length up to 4000, find the length of the longest substring that occurs contiguously in both. | Medium5 | Dynamic programmingString+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Quality InspectionGiven triples of parts (one of each type) with PASS or FAIL results, deduce for every part whether it is certainly good, certainly broken, or undetermined. | Medium5 | ImplementationBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Listing Square Arrangements in Lexicographic OrderList every partition of n whose parts are non-increasing, and print the sequences in decreasing lexicographic order. | Medium5 | BacktrackingRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sum of a SequenceGiven an N by N table holding Ai+Aj for every pair of distinct indices and 0 on the diagonal, recover the original positive sequence A. | Medium5 | MathArray+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Good NumbersCount the elements A_i that equal the sum of three elements appearing earlier in the sequence, where the same earlier element may be reused. | Medium5 | Hash mapBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Drunk CodingMaintain a sequence under point updates and answer range-product sign queries (+/-/0) for each test case until EOF. | Medium5 | Segment treePrefix sum+2 | No attempts yet | 1s | 256 MB | Judgeable |
| JolloGiven the Princess's three cards and two of the Prince's, find the smallest unused third card that lets the Prince win at least two rounds against any order of play. | Medium5 | Brute forceGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Klingon Course LevelsPick a score threshold T that splits every division into basic and advanced groups, minimizing the sum over divisions of |basic - advanced|. Output that minimum. | Medium5 | SortingPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pole PositionGiven the current race order of N cars with each car's position change from the start, reconstruct the starting grid or report that no valid grid exists. | Medium5 | ArraySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Odd or EvenPair each red number with a blue number to minimize how many pairs sum to an even value, since Mary wins those. | Medium5 | GreedyMath+2 | No attempts yet | 3s | 128 MB | Judgeable |
| SupermarketGiven a shopping list and products in path order, buy the list items in order from later positions at minimum total cost, or report impossible. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Milk SchedulingGiven task durations and precedence constraints that form a DAG, find the minimum makespan when unlimited workers milk cows in parallel. | Medium5 | GraphTopological sort+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Milk RoutingPick a single path from node 1 to node N minimizing latency plus X divided by the path's bottleneck capacity, and floor the result. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Clumsy CowsGiven an even-length string of parentheses, find the minimum number of characters to flip so the string becomes balanced. | Medium5 | GreedyString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TypoGiven a bracket string with at most one typo, count how many single-character flips turn it into a valid balanced bracket string. | Medium5 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BookshelfPartition the books in order into shelves whose widths sum to at most L, minimizing the total of each shelf's maximum height. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| IslandsGiven heights along a line, find the maximum number of separate exposed segments at any single rising water level. | Medium5 | SortingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow IDsFind the N-th smallest binary number that has exactly K one-bits and no leading zeros, then print it in binary. | Medium5 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Awkward DigitsGiven a binary string and a ternary string that each differ from the true base-2 and base-3 forms of N in exactly one digit, find N. | Medium5 | Brute forceMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow Beauty PageantGiven a grid with exactly two connected X regions, find the minimum number of dots to paint so the two regions become one. | Medium5 | BFSGraph | No attempts yet | 1s | 128 MB | Judgeable |
| Best ParenthesisGiven a balanced parenthesis string encoded as 0/1 values, compute its recursively defined score modulo 12345678910. | Medium5 | StackRecursion+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Hexagonal Pasture NetworkGiven a hexagon-shaped grid of pastures, count and list all pastures at exact distance L from start H using BFS. | Medium5 | GraphBFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bovine Bridge BattleCount sets of four points that are symmetric about some center, where each point pairs with its 180-degree rotation partner. | Medium5 | Hash mapGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Big DanceRepeatedly split the interval 1..N at the middle (front group gets the extra when odd), pairing cows when a group has exactly two, and add each pair's product to a running sum. | Medium5 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tea TimeStarting from a graph of known meetings, two cows meet whenever they share a mutual friend, and after all rounds settle, answer queries about whether each pair has met. | Medium5 | GraphUnion-find+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Buying Feed, IIPick up to K pounds of feed from stores along a line, paying each store's price plus transport cost of distance carried, and minimize the total. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Word MorphGiven a dictionary of equal-length words, find the fewest one-letter changes needed to turn the start word into the end word through valid words. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Relay RaceEach cow runs one lap, then signals other cows to start; find the time when the last cow finishes, ignoring repeat signals. | Medium5 | GraphBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Building a FenceCount the ordered ways to cut a plank of length N into four positive integer pieces whose longest piece is strictly shorter than the other three combined. | Medium5 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pasture WalkingGiven a weighted tree with N vertices and Q queries, find the path length between each queried pair of vertices. | Medium5 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Switching LightsMaintain a binary array of N lights under M range-toggle and range-count operations, and print each query result. | Medium5 | Segment treeArray+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hay For SaleGiven a wagon capacity and a list of hay bale volumes, find the largest total volume not exceeding the capacity that can be formed by choosing whole bales. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Best SpotGiven a weighted undirected graph and a set of favorite vertices, find the vertex whose average shortest-path distance to all favorites is smallest, breaking ties by smallest index. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Sand CastleGiven current merlon heights and a multiset of target heights in any order, pair them to minimize the total cost of raising and lowering, where raising costs X and lowering costs Y. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow Digit GameFor each starting number, players alternately subtract its largest or smallest nonzero digit, and the player who reaches 0 wins; decide if the first player wins. | Medium5 | Dynamic programmingGame theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow CashCount the number of unordered ways to make an amount N using V coin denominations, where each coin can be used any number of times. | Medium5 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Obstacle CourseOn an N by N grid with blocked tiles, find a walk from A to B that minimizes the number of 90-degree turns; start and end directions are free. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Privileged CowsGiven a sequence of 1s, 2s, and 3s, find the minimum number of arbitrary swaps needed to group all 1s first, then all 2s, then all 3s. | Medium5 | GreedyArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SunscreenEach cow accepts an SPF interval, each bottle has an SPF value and capacity; assign bottles to maximize the number of cows covered. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| String ConstructionRepeatedly take the leftmost or rightmost character of S and append it to T; among all such T, output the lexicographically smallest, wrapping lines at 80 characters. | Medium5 | GreedyString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Radar InstallationEach island on the sea side of a line must be covered by radars of reach d placed on the line, so find the minimum number of placements or report -1 if some island is unreachable. | Medium5 | GreedyIntervals+2 | No attempts yet | 1s | 128 MB | Judgeable |
| String Construction 2Build the lexicographically smallest string by repeatedly taking either the first or last character of the remaining string and appending it, with ties broken by comparing inward. | Medium5 | GreedyTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Charm BraceletChoose a subset of N charms, each with a weight and a desirability, so that total weight stays within M and total desirability is maximized. | Medium5 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow ContestGiven the winners of head-to-head matches, count how many cows have a skill rank that is fully forced by the results. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pearl PairingGiven counts of each pearl color, output the canonical pairing that matches the pearl at position i with the pearl at position i + N/2 in sorted order. | Medium5 | GreedySorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Loathesome Hay BalerRollers touch when center distance equals the sum of radii; find the path from the drive roller to the take-off roller and sum the absolute speeds, truncated. | Medium5 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow TravellingCount the number of walks of exactly T steps on a grid from a start cell to a target cell, where each step moves to a vertically or horizontally adjacent open cell. | Medium5 | Dynamic programmingMatrix+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MunchingFind the length of a shortest grid path from the cow to the barn through grass, then report the number of grass squares munched along it. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Cows on SkatesFind a shortest orthogonal path from (1,1) to (R,C) through open grid cells, breaking ties by the lexicographically smallest sequence of cells. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fence RepairSplit one board into N planks of given lengths; each cut costs the length of the piece being cut, so find the minimum total cost. | Medium5 | GreedyHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tallest CowGiven the tallest cow's height and index plus pairs where cow a sees cow b, find each cow's maximum possible height consistent with all observations. | Medium5 | GreedyPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Managing AllowanceFind the smallest fixed withdrawal amount K so that the N daily costs can be covered using exactly M withdrawals, counting forced top-ups and optional extra ones. | Medium5 | Binary searchGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ATM PIN TheftGiven a sequence of observed key presses (digits and at most one backspace), count the four-digit PINs that could produce exactly that sequence of pressed keys. | Medium5 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Chessboard DanceSimulate a beetle on an 8x8 board following move and turn commands, pushing chains of pieces that may fall off the board. | Medium5 | SimulationImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Crazy SearchCount how many distinct length-N substrings appear in a given text, where the text uses characters from an alphabet of size NC. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Prime LandGiven an integer x in prime-base form (prime powers in decreasing order), print the same representation for x - 1. | Medium5 | Number theoryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PacketsGiven counts of 1x1 through 6x6 square tiles, find the minimum number of 6x6 parcels needed to pack them all. | Medium5 | GreedyImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Extended Lights OutGiven a 5 by 6 Lights Out board, find the unique set of button presses that turns every light off, then print the press grid. | Medium5 | Brute forceBit manipulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| EntropyFor each line of text, print the fixed 8-bit ASCII bit length, the optimal prefix-free Huffman bit length, and the compression ratio rounded to one decimal. | Medium5 | GreedyHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| String ComputerCompute the minimum number of single-character insert, delete, or change operations needed to turn one string into another. | Medium5 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Stockbroker GrapevineFor each directed weighted graph, find the vertex whose shortest paths reach every other vertex, minimizing the maximum distance; print it and that time, or disjoint. | Medium5 | Shortest pathGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FactFor each N up to 10000, find the last non-zero digit of N! and print it with N right-aligned in a field of width 5. | Medium5 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Extrapolation Using a Difference TableExtend a sequence by k steps using a polynomial difference table, always assuming the highest-order differences stay constant, and print the (n+k)-th term. | Medium5 | MathDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Call ForwardingGiven timestamped call forwarding rules, follow each call through the active chain, printing the final extension or 9999 if a loop is entered. | Medium5 | SimulationHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SlurpysGiven up to 10 short strings, decide whether each one is a Slurpy, meaning a Slimp followed by a Slump under the recursive grammar in the statement. | Medium5 | RecursionString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Power ShortageGiven a connected weighted undirected graph, keep a subset of roads so every pair of houses stays connected while maximizing the total length of removed roads. | Medium5 | Minimum spanning treeGraph+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Broken KeyboardFor each test case, find the length of the longest substring of the sentence that contains at most m distinct characters. | Medium5 | Sliding windowString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| El DoradoCount the increasing subsequences of length exactly k in a sequence of n distinct numbers, for several test cases. | Medium5 | Dynamic programmingArray+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Automatic Typo CorrectionGiven a dictionary, classify each queried word as correct, a misspelling of the first similar dictionary word, or unknown, using three specific edit types. | Medium5 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Basic Wall MazeGiven a 6 by 6 grid, three blocking walls, a start and an end square, print the lexicographically smallest shortest path using N, E, S, W moves. | Medium5 | BFSGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wine Trading in GergoviaGiven net wine demands along a line summing to zero, find the minimum total transport cost (one unit per bottle per adjacent step). | Medium5 | GreedyPrefix sum+2 | No attempts yet | 1s | 128 MB | Judgeable |
| 106 Miles to ChicagoGiven a graph where each edge has a percent probability of staying uncaught, find the path from node 1 to node n that maximizes the product of these probabilities. | Medium5 | GraphShortest path+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Sierpinski FractalDraw the outline of a depth-n Sierpinski triangle in ASCII, 2^n rows tall, with no trailing spaces and blank lines between the test cases. | Medium5 | Divide and conquerRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Code the TreeParse a parenthesized tree description, then repeatedly remove the smallest-numbered leaf and print its neighbor to build the Prufer code. | Medium5 | TreeImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Decode the TreeGiven a Prüfer code, rebuild the labeled tree on n vertices and print it as a canonical rooted word with children sorted by number. | Medium5 | TreeHeap+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Anagram GroupsGroup distinct words that are anagrams of each other, then print the five largest groups sorted by size and smallest word. | Medium5 | Hash mapSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Quad TreeDecode a quad tree string into an n by n black and white image, then print each row as XBM hexadecimal bytes. | Medium5 | RecursionDivide and conquer+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FriendsEvaluate set expressions over uppercase letters using union, intersection, and difference, where * binds tighter than + and - and equal operators left-associate. | Medium5 | StringStack+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Team QueueSimulate a team queue where each new element cuts in behind its own teammates, if any, and otherwise joins the tail; print every dequeued element. | Medium5 | QueueHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| France '98Given win probabilities for every pair of 16 teams and a fixed bracket, compute each team's probability of winning the single-elimination tournament. | Medium5 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Solving Linear EquationsParse each linear equation written in a recursive grammar with parentheses and multiplication, then report no, infinite, or the unique solution rounded to six decimals. | Medium5 | MathRecursion+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Humble NumbersFor each n up to 5842, print the nth number whose only prime factors are 2, 3, 5, or 7, formatted with the correct English ordinal suffix. | Medium5 | Dynamic programmingMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Rhinoceros BeetleGiven shared community cards and each player's two hole cards, evaluate every player's best five-card poker hand and print the indices of all winners. | Medium5 | ImplementationSorting+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Collatz ConjectureFor each pair A and B, generate both Collatz sequences up to 1 and find the first value they share, reporting its index in each sequence. | Medium5 | SimulationHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| String EncryptionClean the plaintext (drop spaces, uppercase), then invert the given transposition decryption rule to produce the matching ciphertext. | Medium5 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| God Save the i-th QueenGiven a board and placed queens, count empty squares not sharing a row, column, or diagonal with any queen. | Medium5 | ArrayHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| StorehouseGiven a sequence of truck cargo requests and B bays, decide which bay holds which cargo type to minimize the number of loads, assuming optimal offline knowledge. | Medium5 | GreedyHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Sea BattleCount rectangular ships of '#' cells on a grid, verify no two touch even diagonally, and report bad placement if the ships are not valid rectangles. | Medium5 | ImplementationArray+2 | No attempts yet | 1s | 128 MB | Judgeable |