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,789 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Normal SortImplement a custom string comparator that treats embedded numeric runs (with optional signs) by numeric value and letters case-insensitively, then compare pairs of strings accordingly.Medium5StringImplementation+1No attempts yet1s128 MBJudgeable
Remove ParenthesesGiven an expression with up to 10 matching parenthesis pairs, output every distinct string formed by removing one or more full pairs, sorted lexicographically.Medium5StringBit manipulation+1No attempts yet1s128 MBJudgeable
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.Medium5GreedyString+1No attempts yet1s128 MBJudgeable
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.Medium5Binary searchString+1No attempts yet1s256 MBJudgeable
Pleasant WordCount ways to fill blanks in a word with uppercase letters so it avoids three consecutive vowels or consonants and contains at least one 'L'.Medium5Dynamic programmingString+1No attempts yet1s128 MBJudgeable
Word SearchGiven N database words compared in order against a query using character-by-character matching that also checks for word-end, compute total comparisons per query.Medium5TrieString+1No attempts yet1s128 MBJudgeable
TennisValidate whether recorded tennis set scores form a legal best-of-three match, with a special rule that one named player never loses a set.Medium5SimulationImplementation+1No attempts yet1s128 MBJudgeable
Peter Pan FrameDraw a 5-row banner where each letter of a word sits in a diamond of '#' or '*' depending on its position, with overlapping frames resolved by priority.Medium5SimulationString+1No attempts yet1s128 MBJudgeable
Sangbeom's Secret MessageGiven a Vigenere-style encrypted message and a known substring of the plaintext, deduce the repeating key and decrypt the full message.Medium5StringBrute force+1No attempts yet1s128 MBJudgeable
Sidewalk PillarsGiven a sidewalk string and up to N extra pillars, place pillars in free segments to minimize the count of length-L parking spots, breaking ties by using fewest pillars.Medium5GreedyString+1No attempts yet1s128 MBJudgeable
Restoring a Scrambled EmailGiven a scrambled string formed by replacing '@' with 'at' and optionally inserting 'nospam' once, output all distinct valid email addresses that could produce it.Medium5StringBrute force+1No attempts yet1s128 MBJudgeable
Foot TypingGiven two words and their interleaving, output the lexicographically smallest sequence of 1s and 2s marking which word produced each character.Medium5Dynamic programmingString+1No attempts yet1s128 MBJudgeable
T9Simulate a T9 keypad predictor that maps key-press sequences to dictionary words, splitting on key 1 as space and marking unmatched words with asterisks.Medium5StringHash map+1No attempts yet1s128 MBJudgeable
PINCount pairs of 4-character PINs (from a given list) that differ in exactly D of their four positions.Medium5Hash mapCombinatorics+1No attempts yet1s128 MBJudgeable
Ancient ManuscriptCount ways to fill '*' letters in a word so runs of vowels/consonants respect maximum length and maximum equal-letter-repeat limits, using DP over letter classes and previous letter identity.Medium5Dynamic programmingString+1No attempts yet1s128 MBJudgeable
Decoding Morse SequencesCount the number of ways to split a given Morse code string into a sequence of dictionary words, using dynamic programming with Morse-to-word conversion.Medium5Dynamic programmingString+1No attempts yet1s128 MBJudgeable
Simple ArithmeticSimulate long addition, subtraction, and multiplication of big numbers, printing the numbers and partial products aligned like on paper.Medium5StringSimulation+1No attempts yet1s128 MBJudgeable
Enchanted MirrorDecide if bricks with fixed (real,mirror) letter pairs can be permuted so the row reads T1 and its mirror reads T2, given initial words S1,S2.Medium5Hash mapString+2No attempts yet3s256 MBJudgeable
i18nGiven text lines, expand i18n-style abbreviations back into previously seen full words when the expansion is valid and unique, preserving capitalization and separators.Medium5StringHash map+1No attempts yet1s128 MBJudgeable
Horn ClausesParse Horn clause formulas and decide satisfiability by computing the minimal true-variable assignment via forward chaining, or report unsatisfiable.Medium5GraphImplementation+1No attempts yet2s64 MBJudgeable
Breaking the CipherGiven plaintext, ciphertext, and block size, count permutations of size k that transform every plaintext block into the matching ciphertext block.Medium5CombinatoricsString+1No attempts yet1s128 MBJudgeable
JBCGiven a custom digit ordering and numbers written in it, sum the decimal value of each number over every valid base from 2 up to the digit count.Medium5MathString+1No attempts yet1s128 MBJudgeable
Arne SaknussemmReverse a described scrambling procedure that pads, reverses, and writes a message column by column into a table, given its row fragments, to recover the original text.Medium5StringSimulation+1No attempts yet1s128 MBJudgeable
Pathological PathsGiven a set of file paths defining a directory tree, resolve query paths (with '.', '..', and index.html shortcuts) and decide if two paths refer to the same existing file.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
Good WordsA word of A's and B's is good when its letters can be paired by equal letters with non-crossing arcs; count how many of the given words are good.Medium5StackString+2No attempts yet1s256 MBJudgeable
PalindrometerGiven an odometer reading with fixed digit positions, find the smallest number of kilometers to drive until it reads as a palindrome, counting leading zeros.Medium5StringMath+2No attempts yet1s128 MBJudgeable
BuzzwordsFor each line, strip spaces and report the highest occurrence count among substrings of length 1, 2, 3, and so on, stopping at the first length where no substring repeats.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
Scrolling SignGiven k-wide words, find the minimum total letters scrolled in so that each word appears in order, allowing overlap between consecutive words.Medium5Dynamic programmingString+2No attempts yet1s128 MBJudgeable
Open SourceCount distinct students per project, drop any student who signed up for more than one project, then sort projects by count descending and name.Medium5Hash mapSorting+2No attempts yet1s128 MBJudgeable
Chat RoomsFor each submitted line, decide accept or reject using consonant-run length, the count of recent suspicious lines, and recent duplicate counts over a sliding window of the last 10 lines.Medium5Sliding windowString+2No attempts yet1s128 MBJudgeable
Evil Straw Warts LiveFor each string, find the fewest adjacent swaps needed to rearrange it into a palindrome, or report that no palindrome is possible.Medium5GreedyTwo pointers+2No attempts yet1s128 MBJudgeable
String ExponentiationGiven a string, find the largest exponent n such that the string is a repetition of some base string a raised to n.Medium5StringString matching+1No attempts yet1s256 MBJudgeable
Blue JeansGiven up to 10 DNA strings of length 60, find the longest substring that appears in all of them, breaking ties alphabetically, or report none of length 3 or more.Medium5StringBrute force+2No attempts yet1s128 MBJudgeable
Index GenerationParse markers in a multi-page document, collect page references for primary and secondary index entries, and print the index sorted case-insensitively.Medium5StringSimulation+2No attempts yet1s128 MBJudgeable
Mark-up ProcessorStrip a small mark-up language from text: handle bold, italic, size, and a toggle that turns processing off, printing only the plain characters.Medium5StringSimulation+2No attempts yet1s128 MBJudgeable
Abstract ExtractFor each article, pick the topic sentence of every paragraph with three or more sentences and print them in order.Medium5StringSimulation+1No attempts yet1s128 MBJudgeable
Reverse Roman NotationSimulate a stack calculator where operands are Roman numerals; parse and print them, and handle underflow, division by zero, and out-of-range errors.Medium5ImplementationStack+2No attempts yet1s128 MBJudgeable
Normal FormEvaluate a fully parenthesized AND/OR tree where odd levels are AND and even levels are OR, for several long test cases.Medium5TreeImplementation+2No attempts yet1s128 MBJudgeable
Introduction to Digital CircuitsParse three-valued logic expressions over P, Q, R and count how many of the 27 assignments make the expression evaluate to 2.Medium5RecursionImplementation+2No attempts yet1s128 MBJudgeable
Organize Your Train part IICount distinct strings obtainable by splitting an input string at any point, optionally reversing each part, and concatenating the two parts in either order.Medium5StringBrute force+2No attempts yet1s128 MBJudgeable
lsGiven a wildcard pattern where * matches any run of characters, print the input file names that match it, keeping input order.Medium5Dynamic programmingString+2No attempts yet1s128 MBJudgeable
Playfair CipherBuild a 5x5 Playfair key table from a key phrase, split the plaintext into digraphs with X padding, and apply the row, column, or rectangle substitution rules. Output the uppercase ciphertext.Medium5SimulationMatrix+2No attempts yet1s128 MBJudgeable
Overlap!Given each course's exam day and time slot and each student's course list, count students who have two or more finals that overlap in time.Medium5ImplementationSorting+2No attempts yet1s128 MBJudgeable
Biomedical EngineeringGiven a target string and a set of reusable component strings, find the minimum number of components whose concatenation equals the target, or report that it is impossible.Medium5Dynamic programmingString+2No attempts yet1s128 MBJudgeable
Decimal to FractionConvert a decimal string, with an optional repeating block in parentheses, into the exact fraction in lowest terms.Medium5MathNumber theory+2No attempts yet1s128 MBJudgeable
Jumbled LettersFor each query, find the longest dictionary word that can be formed using the query letters at most once, breaking ties alphabetically, or report IMPOSSIBLE.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
Baby's BlocksGiven a multiset of letters, find the 0-based rank of a given distinct permutation among all distinct permutations in lexicographic order.Medium5CombinatoricsString+1No attempts yet1s128 MBJudgeable
IOIOICount the occurrences of the alternating string P_N (N+1 I's and N O's) as a substring of S, counting overlaps.Medium5StringSliding window+2No attempts yet1s256 MBJudgeable
JOIOI TowerGiven a string of J, O, I disks by increasing radius, find the maximum number of disjoint triples spelling JOI or IOI.Medium5GreedyArray+1No attempts yet1s128 MBJudgeable
JJOOIIFind the largest k such that k J's, then k O's, then k I's appear consecutively in the given string.Medium5StringPrefix sum+1No attempts yet1s128 MBJudgeable
Longest Common SubstringGiven two uppercase strings of length up to 4000, find the length of the longest substring that occurs contiguously in both.Medium5Dynamic programmingString+2No attempts yet2s256 MBJudgeable
Largest Prime SubstringGiven a digit string, find the largest-valued contiguous substring that is prime and at most 100000.Medium5StringBrute force+2No attempts yet1s128 MBJudgeable
Clumsy CowsGiven an even-length string of parentheses, find the minimum number of characters to flip so the string becomes balanced.Medium5GreedyString+2No attempts yet1s128 MBJudgeable
TypoGiven a bracket string with at most one typo, count how many single-character flips turn it into a valid balanced bracket string.Medium5StringImplementation+2No attempts yet1s128 MBJudgeable
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.Medium5BFSGraph+2No attempts yet1s128 MBJudgeable
Hexadecimal to Octal ConversionConvert a hexadecimal number of up to 100,000 digits into its octal form with no leading zeros, using binary as the intermediate step.Medium5StringMath+2No attempts yet1s128 MBJudgeable
Cow TypingGiven a dictionary and short email words, simulate the cow's letter selector with a trie and count total button presses, including circular highlight moves and prints.Medium5TrieString+2No attempts yet1s128 MBJudgeable
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.Medium5GreedyString+2No attempts yet1s128 MBJudgeable
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.Medium5GreedyTwo pointers+2No attempts yet1s128 MBJudgeable
Crazy SearchCount how many distinct length-N substrings appear in a given text, where the text uses characters from an alphabet of size NC.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
FORCALRead text lines in blocks and scan each line into FORCAL tokens (identifiers, literals, symbols, keywords), printing TOKEN ERROR and skipping the block on an invalid string.Medium5StringImplementation+1No attempts yet1s128 MBJudgeable
String ComputerCompute the minimum number of single-character insert, delete, or change operations needed to turn one string into another.Medium5Dynamic programmingString+2No attempts yet1s128 MBJudgeable
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.Medium5RecursionString+2No attempts yet1s128 MBJudgeable
Broken KeyboardFor each test case, find the length of the longest substring of the sentence that contains at most m distinct characters.Medium5Sliding windowString+2No attempts yet1s128 MBJudgeable
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.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
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.Medium5Divide and conquerRecursion+2No attempts yet1s128 MBJudgeable
Anagram GroupsGroup distinct words that are anagrams of each other, then print the five largest groups sorted by size and smallest word.Medium5Hash mapSorting+2No attempts yet1s128 MBJudgeable
Counting Fibonacci NumbersFor each query pair a and b up to 10^100, count how many Fibonacci numbers fall in the closed interval [a, b].Medium5MathBinary search+2No attempts yet1s256 MBJudgeable
FriendsEvaluate set expressions over uppercase letters using union, intersection, and difference, where * binds tighter than + and - and equal operators left-associate.Medium5StringStack+2No attempts yet1s128 MBJudgeable
String EncryptionClean the plaintext (drop spaces, uppercase), then invert the given transposition decryption rule to produce the matching ciphertext.Medium5StringImplementation+2No attempts yet1s128 MBJudgeable
ShuffleGiven a permutation of 27 characters, apply it N times to a short string and print the result.Medium5ImplementationMath+2No attempts yet2s512 MBJudgeable
SnowflakesGiven up to 100,000 snowflakes of six arm lengths each, find whether two are identical under cyclic rotation or reversal.Medium5Hash mapString+2No attempts yet1s128 MBJudgeable
BananasDecide for each word whether it fits the recursive grammar of a monkey language, where words wrap other words in N and in B...S.Medium5StringRecursion+2No attempts yet1s128 MBJudgeable
ScribbleGiven seven tiles with letter values and a dictionary of up to 100000 words, find the highest-scoring dictionary word formable from the tiles, or 0 if none is.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
SpamCount trigram frequencies in sample spam and non-spam messages, then classify each test message by which sample it matches more closely under the cosine similarity measure.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
All Roads Lead Where?Given a tree of cities rooted at Rome and query pairs, print the unique shortest path between each pair as the first letters of the cities on the route.Medium5TreeDFS+2No attempts yet1s128 MBJudgeable
Geocaching CoordinatesGiven a coordinate formula with lowercase letter slots and rules for each variable's allowed values, print every distinct resulting coordinate in lexicographic order.Medium5Brute forceCombinatorics+2No attempts yet1s1024 MBJudgeable
Dynamic Declaration Language (DDL)Simulate a tiny language with dynamic variable declarations, jumps, and increments, printing a repeated-declaration or undeclared-reference error each time one occurs.Medium5SimulationImplementation+2No attempts yet1s128 MBJudgeable
Spell CheckerGiven a dictionary and query words, mark each query correct, or list dictionary words reachable by one deletion, replacement, or insertion.Medium5StringHash map+2No attempts yet1s128 MBJudgeable
Magic TrickFor each of three paragraphs, follow the rule of jumping forward by the current word's length; list all distinct outcomes in the third paragraph, or -outside- if a jump overruns the text.Medium5SimulationImplementation+1No attempts yet1s128 MBJudgeable
Apocalyptic AlignmentGiven two A/B strings of equal length, find the minimum number of operations that repaint a contiguous segment with one fruit type to turn the first string into the second.Medium5Dynamic programmingGreedy+1No attempts yet1s128 MBJudgeable
No Pause TelegraphGiven a string of dots and dashes and seven fixed letter codes, split it into codewords that minimize the resulting message alphabetically, or report that no split exists.Medium5Dynamic programmingString+2No attempts yet1s128 MBJudgeable
Binary WitchGiven a binary string, predict the next L digits by matching suffixes of length 13 down to 1 against earlier occurrences, using the rightmost match.Medium5StringString matching+2No attempts yet1s128 MBJudgeable
The Very Dirty ChainFor each circular string, output the lexicographically smallest rotation, without reversing the chain.Medium5StringTwo pointersNo attempts yet1s128 MBJudgeable
Cash DispenserCount 4-digit PINs whose digits appear as a subsequence of every recorded finger-movement sequence.Medium5StringDynamic programming+1No attempts yet3s128 MBJudgeable
RepetitionsGiven up to five lowercase words of length at most 2000, find the length of the longest substring that appears as a contiguous fragment in every word.Medium5StringBinary search+2No attempts yet3s128 MBJudgeable
Two WordsAfter each swap of one character between the two strings, report which string is lexicographically larger.Medium5Segment treeStringNo attempts yet1s512 MBJudgeable
Palindrome NumbersGiven a decimal integer with up to 1000 digits, print its representation in each base from 2 to 10 where it reads as a palindrome.Medium5MathString+1No attempts yet1s128 MBJudgeable
Poetry with an AsteriskCount for each one-asterisk query how many dictionary words start with its prefix and end with its suffix without overlap.Medium5Hash mapStringNo attempts yet5s128 MBJudgeable
Memory Bit Electrode OperationsYou receive start and target binary strings and compute the fewest prefix or suffix flips that turn the start into the target.Medium5GreedyStringNo attempts yet1s128 MBJudgeable
Bonus WordFind every pair of dictionary words that joins to ten letters and matches each query fixed and shuffled letters, listed in order.Medium5StringBrute force+1No attempts yet1s128 MBJudgeable
77377Split a digit string into dictionary words whose telephone-keypad encoding matches each segment.Medium5Dynamic programmingTrie+1No attempts yet1s128 MBJudgeable
Square CipherEncode each message into letter pairs with a 5x5 square built from the keyword, applying the row, column, and rectangle substitution rules.Medium5SimulationMatrix+1No attempts yet1s128 MBJudgeable
The First TermTrace each given term backward through the reverse look-and-say rule until it reaches its earliest valid ancestor.Medium5SimulationStringNo attempts yet1s128 MBJudgeable
SleepyGiven the word seen after X shuffles that weave the back half into the front half, recover the original word.Medium5SimulationMath+1No attempts yet1s256 MBJudgeable
Encrypted passwordDecide whether the original password's letters can be rearranged to match a contiguous block inside the encrypted password.Medium5Sliding windowHash map+1No attempts yet2s128 MBJudgeable
The Alphabet StickerCount completions of a sticker pattern where each question mark becomes a visible letter and every letter forms one contiguous block.Medium5CombinatoricsStringNo attempts yet1s128 MBJudgeable
SMS PollNormalize phone formats to identify each sender, keep only the earliest valid vote per sender, and print truncated percentages and participant count.Medium5StringHash map+1No attempts yet1s128 MBJudgeable
Search SuggestionFor each typed prefix, print the three highest-scoring matching cities, or the match count when more than 1000 names match.Medium5Binary searchString+1No attempts yet1s128 MBJudgeable
Blue Gene, Jr.Simulate the recursive mutation rules on each short alphanumeric code and print the stabilized code.Medium5RecursionSimulation+1No attempts yet1s128 MBJudgeable