Problems
Pick a problem and write your solution in the built-in editor. The judge runs it against real test cases while you watch, and the wider archive is open to read whenever you like.
Total results1,787 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Prefix Reversal 3Given a string, for each prefix length from 1 to N in order you may choose to reverse that prefix, and you must output the lexicographically smallest string achievable after all choices. | Medium6 | StringGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Deleting DigitsGiven a digit string and a required count of each digit to delete, remove exactly that many occurrences of each digit to leave the numerically largest possible string. | Medium6 | GreedyStack+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Periodic PrefixesFor each prefix of a string, find the largest count n such that the prefix is some substring repeated n times, using prefix-function techniques. | Medium6 | String matchingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Palindrome PartitioningGiven an uppercase string up to length 2500, compute the minimum number of pieces to cut it into palindromic substrings. | Medium6 | Dynamic programmingString | No attempts yet | 2s | 128 MB | Judgeable |
| Making a NumberGiven how many cards exist for each digit 0-9, build the largest possible number using some or all cards so that no two adjacent digits match and no leading zero appears. | Medium6 | GreedyString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Anti-PalindromeRearrange all characters of a string to form the lexicographically smallest anti-palindrome, where each pair of symmetric positions must differ, or report impossible. | Medium6 | GreedyString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Artist Lee DonghoGiven a black/white grid and a limit on horizontal single-color brush strokes, find the minimum number of cells that end up unpainted or wrongly colored. | Medium6 | Dynamic programmingPrefix sum+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Substitution Sequence Range CountsCount occurrences of 1, 2, 3 in a fixed interval of a sequence generated by simultaneous ternary substitution after N steps, without building the whole sequence. | Medium6 | RecursionDivide and conquer+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Making the Best Phone NumberSplit a digit string into groups of 2 or 3 to maximize a score based on group types, then output the lexicographically smallest optimal formatting. | Medium6 | Dynamic programmingString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Longest Repeated SubstringFind the length of the longest substring that occurs at least twice in a given string of up to 200,000 lowercase letters. | Medium6 | Binary searchString matching+2 | No attempts yet | 2s | 128 MB | Judgeable |
| XYZ StringGiven a self-similar X/Y/Z rewriting sequence, answer queries about the stage N string's length, its k-th character, or the count of a given character without building the full string. | Medium6 | RecursionDivide and conquer+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Resident Registration NumberGiven a 19-digit ID pattern with some digits erased, count completions that form a valid birth date and satisfy the modular checksum rule for the last digit. | Medium6 | CombinatoricsMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Colored SticksGiven colored-end sticks, decide if they can all be joined into one line where touching ends share the same color, which reduces to checking an Eulerian path exists. | Medium6 | Union-findGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| CubeditorGiven a lowercase string of length up to 5000, find the maximum length of a substring that occurs at least twice, allowing overlapping occurrences. | Medium6 | StringDynamic programming+1 | No attempts yet | 0.5s | 128 MB | Judgeable |
| Mirror NumbersCount how many numbers between A and B (up to 10^18) read the same when reflected in a mirror, using only digits 0,1,2,5,8 with 2 and 5 swapped. | Medium6 | CombinatoricsString+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Strange KeyboardGiven a string on a cursor-based keyboard, find the minimum Left/Right/Enter presses needed to print every character in alphabetical order. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Paper FoldingGiven a crease pattern of length 2^N-1, decide if it could arise from repeatedly folding the right half of a strip onto the left half. | Medium6 | Divide and conquerRecursion+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Adjacent MastermindGiven pairs of target and guess letter strings, compute black, grey, and white Mastermind scores by matching exact, then adjacent, then distant letters in priority order. | Medium6 | StringGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Greatest Common Divisor of OnesGiven the digit counts N and M of two repunits, print their GCD, which equals the repunit with gcd(N,M) ones, requiring big-number output construction. | Medium6 | Number theoryMath+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Word GameGiven a string and a dictionary of words, find the minimum number of characters to delete from the string so the rest is a concatenation of dictionary words in order. | Medium6 | Dynamic programmingString matching+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Roman Numeral SentencesFind the largest number whose canonical Roman numeral form can be picked out as an in-order subsequence of letters from a given sentence. | Medium6 | GreedyString matching+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Caesar CipherGiven a custom alphabet order, plaintext word, and cipher text, find all shift values for which decrypting yields the word exactly once, using string matching over a large alphabet. | Medium6 | String matchingString+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Logical ExpressionsParse a custom logical expression grammar with user-defined unary and binary operator truth tables, then evaluate it to true, false, or unknown given partial variable assignments. | Medium6 | RecursionString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Digital FriendsGiven three pairs of huge integers, classify each pair as friends, almost friends, or nothing based on digit-set equality achievable by at most one adjacent digit transfer operation. | Medium6 | StringBrute force+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Cascading WindowsParse windows with titles from an ASCII screen, sort them by title, and redraw them cascaded diagonally from the top-left corner. | Medium6 | SimulationString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Restoring Calculation ExpressionsInsert +, -, or * between digits of a string (length up to 9, no leading zero numbers) to produce all expressions evaluating to 2000, sorted lexicographically. | Medium6 | BacktrackingBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Necklace SequenceDecompose a binary string into a strictly decreasing sequence of Lyndon-like necklace factors where adjacent concatenations fail the necklace property. | Medium6 | StringGreedy+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Palindrome PartitionGiven a lowercase string up to length 2000, find the minimum number of palindromic substrings it can be partitioned into. | Medium6 | Dynamic programmingString | No attempts yet | 2s | 128 MB | Judgeable |
| Shortest Uncommon SubsequenceGiven two strings, compute the length of the shortest subsequence of A that is not a subsequence of B. | Medium6 | Dynamic programmingString | No attempts yet | 2s | 128 MB | Judgeable |
| Binary NumberGiven N up to 1000, count consecutive-zero groups in the N-th generation of the Thue-Morse-like doubling sequence without building the exponentially large string. | Medium6 | StringMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| GPS EncodingGiven a letter permutation encoding numbers 0-25, find the shortest way to encode a digit string as letters using single digits or valid two-digit pairs, breaking ties by lexicographically largest result. | Medium6 | Dynamic programmingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Conflicting StringsDecide, for each set of equal-length strings with wildcard '*', whether removing at most k strings can make every position agree on one letter. | Medium6 | GreedyString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| GeneFind the maximum-length subsequence of a DNA string that can be built by the given nested and concatenated matching-pair grammar (like balanced parentheses with a/t and g/c pairs). | Medium6 | Dynamic programmingString | No attempts yet | 2s | 128 MB | Judgeable |
| String ReconstructionCount length-L strings over an alphabet such that every length-k substring belongs to a given allowed set, solved via automaton/DP over overlaps. | Medium6 | Dynamic programmingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Minimum Edit Distance 2Compute the minimum number of insert, delete, replace, and adjacent-swap operations to transform string X into string Y. | Medium6 | Dynamic programmingString | No attempts yet | 2s | 128 MB | Judgeable |
| Keyboard TypoSimulate 2-beolsik Korean keyboard input composition rules to find the position of the first character that breaks valid syllable formation. | Medium6 | SimulationImplementation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Secret SharingConcatenate all given digit strings in the order that yields the smallest possible integer without a leading zero, or print INVALID if impossible. | Medium6 | GreedyString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Median StringGiven three equal-length strings, construct a string minimizing the maximum Hamming distance to all three and output that minimum radius. | Medium6 | GreedyString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| DNA SimilarityFind substrings of two DNA sequences that maximize a local sequence-alignment score with custom match and mismatch/gap penalties, and output the score and substrings. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| Good SequenceConstruct the lexicographically smallest square-free string of length N over the alphabet {1,2,3} (no two adjacent equal-length substrings identical). | Medium6 | GreedyString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| QR DecodingParse a 19-byte QR data payload bit by bit and decode its numeric, alphanumeric, byte, and kanji mode segments into a formatted output string. | Medium6 | Bit manipulationString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hanging MonkeysParse a nested bracket string representing a binary vine structure and compute the minimum monkeys needed so every split has equal counts on both sides. | Medium6 | RecursionString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Tax Note XML ConversionParse shorthand tax notes with rate, end month/year, and start month/day, then output valid entries as strict XML or mark ambiguous or invalid lines as bad data. | Medium6 | StringImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Logical Expression EquivalenceParse two concatenated boolean expressions with C-style operator precedence and decide if they are logically equivalent for all variable assignments. | Medium6 | StringBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| DNA DiscoveryGiven a binary string, find the minimum number of single-character flips or whole-prefix flips needed to turn every character into A. | Medium6 | GreedyDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Square CrosswordCount distinct ways to pick four distinct equal-length words to fill a square crossword so top/bottom rows and left/right columns match corner letters. | Medium6 | Hash mapBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| New Language Alphabet OrderGiven a sorted list of words in an unknown alphabet, reconstruct the unique letter order or report impossibility or ambiguity. | Medium6 | Topological sortGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bored JungyuGiven XOR values of a lowercase/period/space plaintext with a digit key, decide for each position whether the original was a letter or a period/space. | Medium6 | Bit manipulationBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Roman Numeral RearrangementGiven a Roman numeral for a number under 100, rearrange all its characters to form the valid Roman numeral with the smallest possible value. | Medium6 | Brute forceString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Valid Bracket StringsCount ways to replace question marks in a bracket string with one of three bracket types so it becomes a valid nested bracket sequence, output last five digits. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| Dot Matrix PrinterGiven a string, find the minimum number of SET/NEXT/WRITE printer commands needed to output it, where NEXT temporarily overrides the next WRITE. | Medium6 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hangman GameGiven a hidden word, find the order to select each distinct letter starting from A on a circular alphabet dial that minimizes total LEFT/RIGHT/OK button presses. | Medium6 | Dynamic programmingGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Geographic MapGiven a grid with village markers 'x' and horizontal uppercase name strings, match each village to its adjacent name using adjacency and uniqueness constraints, then output village positions and names. | Medium6 | ImplementationString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Lazy TelegraphFor each dictionary word to be sent, find a same-length string minimizing total transmission time (dots=1s, dashes=2s) so that it is the unique closest dictionary word by Hamming distance, then sum the minimum times. | Medium6 | Brute forceString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hyunju and Yunju's Fun Word GameCount unordered word pairs (A,B) where A<B lexicographically but reverse(B)<reverse(A), given up to 100,000 distinct words. | Medium6 | SortingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Word DivisionCount the number of ways to split a long word (up to length 300,000) into consecutive substrings all belonging to a dictionary of up to 4000 short words, modulo 1337377. | Medium6 | Dynamic programmingString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| KokosGiven N words of length 2K, build a trie for the first K letters and a reversed trie for the last K letters and find the minimum vertex count of a graph satisfying strict in/out degree branching-then-merging structure. | Medium6 | TrieString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Password Name FinderFind the minimum set of 2 to 5 distinct girl names of length 3 to 8 whose pairwise concatenations reconstruct all given passwords. | Medium6 | StringBacktracking+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Two Subsequences 2Given two strings A and B of length up to 2000, find the shortest string that is a subsequence of A but not a subsequence of B. | Medium6 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bar CodeReconstruct the unique binary digit sequence from a partially unreadable bar code grid of black/white/unknown squares, or report it cannot be determined. | Medium6 | BacktrackingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Moore MachineParse a series-parallel Moore machine expression and determine the unique erased output symbol that matches an observed string, or report ambiguity or impossibility. | Medium6 | Dynamic programmingString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FATBOYFind the longest common subsequence of three given strings, breaking ties by lexicographically smallest result. | Medium6 | Dynamic programmingString | No attempts yet | 1s | 128 MB | Judgeable |
| SimilaritySum, over every alignment of a pattern against a text without gaps, the count of matching letter positions, for texts up to 2,000,000 characters. | Medium6 | String matchingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| BracketsCount, modulo 1e9+9, the ways to turn some matching '(' '(' pairs back into '[' ']' so the bracket string becomes valid with at least one square pair. | Medium6 | Dynamic programmingStack+1 | No attempts yet | 1s | 128 MB | Judgeable |
| MelodyGiven N notes with S-digit codes and a target tune of length L, choose a sequence of notes with adjacent Hamming distance at most G that minimizes total mismatch with the written tune, then output the smallest such sequence lexicographically. | Medium6 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Magic ParenthesisGiven a bracket string with wildcard characters ']' that each consume one or more open parentheses, determine feasibility and output the lexicographically largest assignment of counts for each wildcard. | Medium6 | GreedyStack+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Substitution CipherGiven encrypted words known to be in lexicographic plaintext order and an encrypted message, determine the substitution mapping uniquely if possible and decrypt or report failure. | Medium6 | StringGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Glass BeadsFind the starting index that produces the lexicographically smallest rotation of a circular string of beads, using an efficient least-rotation algorithm. | Medium6 | StringString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Ideal ContestParse an ASCII contest scoreboard and compute several weighted penalty metrics (vainness, oversimplification, evenness, unsolvability, instability per problem) into a total negidealness score. | Medium6 | ImplementationSimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| KenningsExpand a text plan by repeatedly substituting kenning referents with their bodies until reaching a length threshold, then reflow the text to a given line width. | Medium6 | SimulationString+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Please Go FirstGiven a queue string where equal characters denote groups, compute total seconds saved when people yield positions so each group can board together as early as possible. | Medium6 | GreedySimulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| High ScoreCompute the minimum joystick moves (up/down letter changes and left/right cursor moves, with wraparound) needed to type a target uppercase string starting from all 'A's. | Medium6 | GreedyString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Common Subexpression EliminationCompress a labeled binary expression tree into a minimal DAG by merging identical subexpressions and print it with backreference numbers to earlier nodes. | Medium6 | Hash mapTree+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Palindrome DateGiven a date, find the next date whose YearMMDD string is a palindrome, handling huge years and leap years correctly. | Medium6 | StringMath+1 | No attempts yet | 5s | 128 MB | Judgeable |
| Computer TransformationGiven n up to 1000, compute the count of adjacent | Medium6 | MathString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Delta Encoding and DecodingImplement a stateful command interpreter that encrypts, decrypts, or redefines a letter-substitution cipher based on positional value differences, with exact output formatting. | Medium6 | StringImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Hidden PasswordFind the starting index of the lexicographically smallest rotation of a string, choosing the smallest index in case of ties (Booth's algorithm). | Medium6 | StringString matching+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Turn S into TGiven strings S (with 0,1,?) and T (0,1), compute the minimum number of change/swap operations to transform S into T, or -1 if impossible. | Medium6 | GreedyString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Production ProcessGiven a matrix chain-like joining table for pieces, find the minimum-time parenthesization to assemble a given string, breaking ties by piece order. | Medium6 | Dynamic programmingString+1 | No attempts yet | 5s | 128 MB | Judgeable |
| The Chemist's MathematicsParse chemical equations with nested parentheses and molecule counts, then solve the resulting linear system to find the minimal positive integer coefficients balancing each element. | Medium6 | MathString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Confusing Login NamesCompute an extended edit distance (insert, delete, replace, adjacent swap) between all pairs of given login names and output pairs within a given threshold, sorted alphabetically. | Medium6 | Dynamic programmingString+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Suffix Array Re-constructionReconstruct a base string from partial suffix descriptions, where each suffix may contain one wildcard block, and decide when that is impossible. | Medium6 | StringImplementation+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Genetic FraudDecide whether two equal-length strings share an aligned substring of length at least ceil(N/2) where every pair of aligned letters differs by at most 1. | Medium6 | StringTwo pointers+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HackingFind the shortest lexicographically smallest string over the first k letters that appears nowhere as a substring of a given text, with length capped at m. | Medium6 | StringBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Road SeriesGiven signs of text processed in order, track how far the consecutive count from 1 reaches while remembering seen numbers only within a sliding window. | Medium6 | SimulationHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Decompressing in a GIFDecode a digit string compressed with a simplified GIF LZW scheme, rebuilding the dictionary and tracking when the encoding width grows. | Medium6 | StringHash map+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Compound WordsGiven a dictionary of up to 120,000 sorted lowercase words, list every word that can be split into two shorter dictionary words. | Medium6 | TrieString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Card HandsGiven several ordered card hands, merge lists that share a common suffix and report the total number of linked list nodes needed. | Medium6 | TrieString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Based Integer ConstantsFor each string, decide whether it is a valid Ada integer constant, which may nest a based integer as the base of another based integer. | Medium6 | StringRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| All Your BaseRead two mixed-radix numbers, where digit n (from the right) has base n+1, apply the given addition or subtraction, and print the result in the same system or Invalid. | Medium6 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Words and the Periodic TableSplit each word into element symbols, case-insensitively, choosing the split with the fewest parts, then the lowest atomic-number sum. | Medium6 | Dynamic programmingString+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Phil in the BlanksA puzzle sentence has up to four blanks to fill with number words (zero to one hundred); the filled sentence must correctly count letters, vowels, consonants, or given characters including the inserted words. Count solutions. | Medium6 | Brute forceString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Schottkey 7th PathGiven files in locations and per-user search paths, return the files matching each request within two extra characters, honoring location priority. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Party GamesGiven n distinct uppercase names, find the shortest string S such that exactly half the names are <= S and half are > S, breaking ties by the alphabetically smallest S. | Medium6 | StringSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Generic Units ConversionParse two measurement systems with internal conversion rules, then convert each quantity so every unit of the second system appears with a greedy integer count, rounding the smallest unit. | Medium6 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| HTML EditorGiven a valid HTML string and a range, output that substring wrapped with the tags needed to preserve its formatting. | Medium6 | StringStack+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ChemistryParse a chemical formula with nested parentheses and multipliers, then output each element's total atom count in lexicographic order. | Medium6 | StackString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Removing ParenthesesGiven an expression of single-letter variables with addition and multiplication, remove every pair of parentheses that can go without changing the value, and print the result. | Medium6 | StackString+2 | No attempts yet | 1s | 128 MB | Judgeable |
| XML ValidatorDecide for each input line whether it is valid XML: matching open and close tags, allowed plain text, and proper escape sequences. | Medium6 | StringStack+1 | No attempts yet | 1s | 128 MB | Judgeable |
| ResistorsParse a nested expression of series and parallel resistor connections and output the exact resistance as a reduced fraction. | Medium6 | StringStack+2 | No attempts yet | 1s | 128 MB | Judgeable |