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 results457 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| PokegeneCount, for each query, how many string prefixes occur in exactly L of the K listed genomes. | Medium5 | StringString matching+1 | No attempts yet | 2s | 512 MB | Judgeable |
| String DistanceGiven strings O and N, find the minimum number of substring-insertion operations to turn O into N, or output -1 if impossible. | Medium6 | Dynamic programmingString+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 |
| 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 |
| 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 |
| 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 |
| Shortest Non-subsequenceGiven a sequence of values from 1 to k, find the minimum length of a sequence over that alphabet that cannot be found as a subsequence of it. | Medium6 | GreedyString matching+1 | 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 |
| 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 |
| Phone Number MnemonicsFind the minimum number of dictionary words whose digit encodings concatenate to exactly match a given phone number, using the letter to digit telephone mapping. | Medium6 | Dynamic programmingString matching+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Cipher Decoder Choi JunminFind the earliest starting word position in an encoded word sequence that matches a pattern sentence under a bijective word-to-word substitution mapping. | Medium6 | String matchingHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Card SolitaireGiven several queues of cards, repeatedly pop the front of some queue to append to an answer sequence so that the final sequence is lexicographically smallest. | Medium6 | GreedyString matching+1 | No attempts yet | 5s | 128 MB | Judgeable |
| String CensorshipRepeatedly delete the first then last occurrence of a pattern string from a text until it's absent, and output the final text. | Medium6 | String matchingStack+1 | No attempts yet | 1.5s | 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 |
| 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 |
| 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 |
| 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 |
| Where's WallyDecode base64-like bit matrices for an image and a square pattern, then count all image squares matching the pattern under any rotation or mirror flip. | Medium6 | MatrixString matching+2 | No attempts yet | 4s | 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 |
| 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 |
| DividingFor each case with t, a, b, decide whether (t^a-1)/(t^b-1) is an integer below 100 digits, and print it or a fixed message. | Medium6 | Number theoryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| StringerGiven fixed counts of each of N letters, find the K-th string in alphabetical order among all arrangements, without listing them. | Medium6 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hide That NumberGiven the disguised value (11 times the original, truncated to the original's digit count), recover the original number or report IMPOSSIBLE. | Medium6 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Finding a MultipleFor each n up to 200, print the smallest multiple of n whose decimal digits are only 0 and 1, with up to 100 digits. | Medium6 | BFSNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Card Game is FunAnna may delete arbitrary cards from her sequence and Bruno may trim cards from the top and bottom of his; find the longest common subarray obtainable. | Medium6 | Dynamic programmingArray+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Villain RobotsChoose a string of K characters over {A,B,C} maximizing the total number of substring occurrences of the given pattern strings. | Medium6 | Dynamic programmingString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Network WarsSimulate two programs moving through a labeled graph, one searching alphabetically forward and one backward, until one is trapped or destroyed. | Medium6 | GraphSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| StrategyParse a small strategy language, then simulate every pair of up to 10 programs for 10 rounds and print each program's total score. | Medium6 | ImplementationSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Pascal Program LengthsCount the scored tokens (reserved words, identifiers, constants, parentheses, brackets, and listed operators) in each Turbo Pascal program, skipping comments and strings, and print the member's name with the total. | Medium6 | StringImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Truck HistoryConnect all truck codes so the total Hamming distance is minimized, then print 1/Q. This is a minimum spanning tree on a complete graph. | Medium6 | Minimum spanning treeGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Comment removalStrip Pascal comments and collapse whitespace, honoring single-quote strings where doubled quotes are literals and comments can span lines. | Medium6 | StringSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Number PairsFor a given N, list all pairs (X, Y) with X + Y = N where deleting one digit from X yields Y, and count them. | Medium6 | MathBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| VirusDecide whether every one of N integer sequences shares some contiguous fragment of length at least K, counting reversals as the same fragment. | Medium6 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cell phone tunesDecide whether a given tune is good (no adjacent equal-multiset blocks), contains all n sounds, and cannot be extended by a single sound on either end. | Medium6 | String matchingImplementation+1 | No attempts yet | 1s | 32 MB | Judgeable |
| SignalGiven sequence s and a pattern f, find the smallest starting position where f occurs as a contiguous block that can be one of exactly k fragments of lengths in [a,b]. | Medium6 | String matchingGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fibonacci WordsCount the occurrences of a given a/b pattern as a contiguous substring of the n-th Fibonacci word, overlaps included. | Medium6 | StringDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| JanSplit a given lowercase word into the fewest pieces, each of which is lexicographically smaller than all of its nontrivial rotations, and print one valid minimum split. | Medium6 | StringGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SignalsCompare the signal sets generated by two series-parallel circuit expressions and print whether they are equal, nested, disjoint or overlapping. | Medium6 | String matchingRecursion+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Practice SeasonBoth teams insert rest days into their fixed city orders to minimize combined stadium and hotel costs. | Medium6 | Dynamic programmingString matching | No attempts yet | 2s | 128 MB | Judgeable |
| Substring Set MembershipYou receive a set of patterns and query strings and print YES for each query containing a pattern as a contiguous substring, NO otherwise. | Medium6 | String matchingTrie | No attempts yet | 1s | 256 MB | Judgeable |
| Swyper KeyboardExpand a swipe path over a four-row letter grid into every key each segment crosses, then print the first dictionary word that is a subsequence of it. | Medium6 | GeometryString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Genetically Modified AppleInsert priced letters into a DNA string so a given gene appears as a contiguous block at minimum total cost. | Medium6 | Dynamic programmingString matching | No attempts yet | 1s | 128 MB | Judgeable |
| (ℓ, d) patternFind the unique length-l lowercase string within Hamming distance d of some substring in every given string. | Medium6 | Brute forceString matching | No attempts yet | 2s | 512 MB | Judgeable |
| Secret CodeCount the sequences of operations that build the given string from a source of length at least 2 by gluing each string to a copy missing one end character. | Medium6 | Dynamic programmingString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| MutationCount overlapping occurrences in a DNA string of a marker and all strings formed by reversing one substring of the marker. | Medium6 | String matchingHash map | No attempts yet | 2s | 256 MB | Judgeable |
| RLE ReplacementReplace the first occurrence of RLE string B inside RLE string A with RLE string C and print the result in RLE form. | Medium6 | String matchingTwo pointers+1 | No attempts yet | 2s | 128 MB | Judgeable |
| HamzawyFind the longest string that is a non-overlapping prefix, suffix, and middle substring of each given string. | Medium6 | String matching | No attempts yet | 1s | 256 MB | Judgeable |
| ConcatenationCount distinct strings formed by joining a nonempty prefix of the first word with a nonempty suffix of the second word. | Medium6 | String matchingCombinatorics | No attempts yet | 2s | 256 MB | Judgeable |
| Loda TeleportationsGiven N strings in order, find the longest subsequence where each earlier string is both a prefix and a suffix of the later one. | Medium6 | Dynamic programmingString matching+1 | No attempts yet | 1s | 64 MB | Judgeable |
| Performance Assessment 1Find the shortest sequence over 1 to M missing as a contiguous block of A and count such sequences modulo 1e9+7. | Medium6 | String matchingHash map+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Password-free alphabet arrangementArrange A to Z in one row so none of the given passwords appears as a contiguous block, choosing the smallest such order or reporting impossibility. | Medium6 | BacktrackingString matching+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Finding 123456789Count subsets of occurrences of P in S whose starting positions multiply to a common multiple of 1 through 9, modulo 1000000007. | Medium6 | Dynamic programmingString matching+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Number of Strings Containing a SubstringCount length-L lowercase strings that contain the given word S as a contiguous substring, modulo 1,000,000,009. | Medium6 | Dynamic programmingString matching | No attempts yet | 2s | 512 MB | Judgeable |
| Wildcard (Small)Given two lowercase names, output the shortest wildcard pattern of letters and stars that matches the first name but not the second. | Medium6 | String matchingBrute force+1 | No attempts yet | 5s | 512 MB | Judgeable |
| PermRLE (Small)Split the string into fixed blocks of length k, permute each block the same way, and minimize the number of runs in the result over all k! permutations. | Medium6 | Brute forceSorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Prefix and SuffixCount the distinct substrings of S that both start with string A and end with string B, where A and B may overlap within a substring. | Medium6 | StringHash map+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Programming TutorsGiven N students and N tutors in a Manhattan-metric city, find the smallest K such that every student can be matched with a distinct tutor at distance at most K. | Medium6 | Binary searchGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Musical PlagiarismGiven a song as a sequence of notes and a suspect excerpt, decide whether the excerpt appears in the song under some transposition (key change). | Medium6 | String matchingArray+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Where To Go?A note string uses upper case letters and each station name uses lower case letters, so a match between them is an equality-pattern match between two windows of different alphabets. | Medium6 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Jumbled passwordGiven a string, find the smallest index past the midpoint where the suffix differs from the prefix of equal length in exactly one character. | Medium6 | StringString matching+2 | No attempts yet | 0.5s | 1024 MB | Judgeable |
| An Unfair PuzzleGiven two permutations of 1..n, decide whether cyclic rotations and reversals can turn the first into the second, printing good puzzle or bad puzzle. | Medium6 | StringString matching+2 | No attempts yet | 2s | 256 MB | Judgeable |
| Anagram Pyramids (Hard)Given a dictionary and query word pairs, decide whether an anagram pyramid can be built from the top word down to the bottom word. | Medium6 | GraphDFS+1 | No attempts yet | 10s | 512 MB | Judgeable |
| Digit RearrangementGiven A and B, rearrange the digits of A (no leading zero) to build the largest permutation that is still strictly less than B, or print -1. | Medium6 | BacktrackingGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Typo SquattingFor each domain name, count how many other given domains differ from it in exactly one character position. | Medium6 | Hash mapString+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Gluing PicturesGiven a city string C, find for each friend name the fewest substrings of C that concatenate to form it, or -1 if impossible. | Medium6 | Dynamic programmingString matching+2 | No attempts yet | 0.3s | 512 MB | Judgeable |
| Assessing GenomesCompute each DNA string's smallest repeating unit length, then pair the two sets of scores to minimize the sum of squared differences. | Medium6 | StringSorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Ponk WarshallGiven two equal-length strings over {A,C,G,T} with matching letter counts, find the minimum number of arbitrary swaps that turn the first string into the second. | Medium6 | GreedyImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| DISHFor each pair of strings, output a shortest string that contains both input strings as substrings. | Medium6 | StringDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| CatCount how many distinct strings you can form by joining a non-empty suffix of a with a non-empty prefix of b. | Medium6 | StringString matching+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Two PrefixesGiven strings s and t, count distinct strings formed by concatenating a non-empty prefix of s with a non-empty prefix of t. | Medium6 | StringString matching+2 | No attempts yet | 1s | 512 MB | Judgeable |
| DNA Deletions and Protein CountCount, modulo 1e9+7, the distinct proteins obtainable by deleting some nucleotides from a DNA string and translating the remaining codons via a given table. | Medium7 | Dynamic programmingGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Magic StringCount permutations of up to 8 given words whose concatenation is a string that has exactly K circular shifts equal to itself. | Medium7 | String matchingBrute force+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Palindrome Word SequencesCount ordered sequences of given words, reused any number of times, whose concatenation has exact length L and forms a palindrome. | Medium7 | Dynamic programmingString matching+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Four SubstringsGiven a string and four of its substrings, pick one occurrence of each so that the union of the covered positions has the fewest and the most distinct characters. | Medium7 | String matchingIntervals+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sequence RestorationReconstruct any original length-N sequence given all its overlapping length-M contiguous subsequences in arbitrary order. | Medium7 | Hash mapGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Largest Square KillerGiven an R x C binary grid, find the side length of the largest square submatrix that remains unchanged after a 180 degree rotation. | Medium7 | String matchingBinary search+2 | No attempts yet | 5s | 128 MB | Judgeable |
| String Period PredictionUsing KMP-style prefix functions, find for every prefix the largest period-like split point and sum these values across the whole string. | Medium7 | String matchingString+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Maximum String PastingGiven a long string and up to 500 short patterns, find all their occurrences and select non-overlapping intervals to maximize total covered length via DP. | Medium7 | String matchingDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| GeneReconstruct a unique circular-free DNA sequence from overlapping fragments (usable forward or reversed) split across k identical copies, then print the lexicographically smaller of it and its reverse. | Medium7 | String matchingGraph+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Reading UPC BarcodesGiven a 95-bit UPC-A barcode string with unknown bits and possible reversal, enumerate all valid 12-digit UPC codes matching the pattern and checksum. | Medium7 | String matchingBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| ASCII StreetGiven a street string and multiple pattern tiles, count how many street positions are never covered by any occurrence of any pattern, requiring efficient multi-pattern matching like Aho-Corasick. | Medium7 | String matchingTrie+1 | No attempts yet | 4s | 512 MB | Judgeable |
| Longest Repeated SubstringGiven a lowercase string of up to 200000 characters, compute the length of the longest substring that occurs at least twice, allowing overlaps. | Medium7 | StringBinary search+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Formula SubstitutionGiven two formula strings with variables 0 and 1, find basic-formula substitutions for both variables that make the two formulas syntactically identical, similar to unification. | Medium7 | RecursionString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Character EquationGiven a recursive definition of a huge string T through variable concatenation equations, determine whether a pattern P is a subsequence of T without expanding T explicitly. | Medium7 | Dynamic programmingString+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Size of the DictionaryCount distinct words formed as base words themselves, plus prefix-of-one-base-word concatenated with suffix-of-another-base-word combinations. | Medium7 | TrieString matching+1 | No attempts yet | 2s | 128 MB | Judgeable |
| KINA Is Not AbbreviationGiven a text, find the abbreviation (initials of a consecutive word window) that is unambiguous per the stated rules and maximizes letter-count reduction, breaking ties lexicographically. | Medium7 | String matchingHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Orthogonal ClosureGiven two binary strings, decide whether T equals the XOR of some pair of circular shifts of S, requiring an efficient algorithm beyond brute force for n up to 5000. | Medium7 | String matchingBit manipulation+1 | No attempts yet | 2s | 64 MB | Judgeable |
| PolylopsGiven the vertices of a simple polygon, count how many distinct lines reflect it exactly onto itself. | Medium7 | GeometryString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Stems SellApply ordered pattern-to-replacement rewrite rules, which support *, V, C, and back-references, to every word in each paragraph. | Medium7 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Shape NumberGiven a chain code, take its first difference mod 8 and print the lexicographically smallest cyclic rotation of that sequence. | Medium7 | StringString matching+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Comparing CodeFind the longest run of HAL's lines that matches a run of RBN's lines up to injective variable renaming and swapping the two right-hand operands. | Medium7 | String matchingHash map+1 | No attempts yet | 1s | 128 MB | Judgeable |
| String FarmGiven up to 10^4 strings, find the longest chain where each string is a contiguous substring of the next, all photos distinct. | Medium7 | StringDynamic programming+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Emoticons :-)Given a set of emoticon strings, replace the fewest characters with spaces across several text lines so that no emoticon appears consecutively in any line. | Medium7 | String matchingDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| NecklaceGiven a string and a pattern, delete the fewest characters so the pattern no longer appears as a contiguous substring. | Medium7 | Dynamic programmingString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Threatening LetterGiven a newspaper string and a message, split the message into the fewest contiguous pieces, each of which appears somewhere in the newspaper. Output that minimum count. | Medium7 | StringDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| EnigmaGiven a partial Enigma key and plaintext with a few unknowns, complete the decryption of the ciphertext. | Medium7 | Brute forceSimulation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Roman NumeralsEach line gives a Roman sum A+B=C. Decide whether it holds as a Roman numeral equation, then classify its cryptarithm as impossible, ambiguous, or valid. | Medium7 | Brute forceBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Corporate IdentityGiven up to 4000 short lowercase strings, find the longest string that occurs as a contiguous substring of every one, breaking ties by lexicographic order. | Medium7 | StringString matching+2 | No attempts yet | 1s | 128 MB | Judgeable |
| SubstringsCount the distinct substrings of a string, including the empty string and the whole string, for up to 5000 characters per test case. | Medium7 | StringTrie+2 | No attempts yet | 1s | 128 MB | Judgeable |