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
RunesFind the smallest digit that replaces every question mark so the addition, subtraction, or multiplication equation holds.Medium4Brute forceString+1No attempts yet5s256 MBJudgeable
Ambiguous EncodingsCount how many letter strings map to each digit string when A is 1 through Z at 26.Medium4Dynamic programmingStringNo attempts yet1s256 MBJudgeable
Exact a to the power bPrint the exact value of a to the power b for a decimal base without rounding or dropping digits.Medium4ImplementationMath+1No attempts yet1s256 MBJudgeable
Shortest string containing bothFind the length of the shortest string that has both given strings as subsequences.Medium4Dynamic programmingStringNo attempts yet1s256 MBJudgeable
Talking MoneyConvert one currency amount from -$999999999999.99 to $999999999999.99 into English words under the given hyphen, and-placement, and plural rules.Medium4ImplementationStringNo attempts yet2s256 MBJudgeable
Decimal to FractionConvert a decimal with an optional parenthesized repeating part into its irreducible numerator/denominator form.Medium4MathNumber theory+1No attempts yet2s256 MBJudgeable
RATS sequenceSimulate up to 60 RATS steps per data set and report the first creeper term, the first repeated term, or the last term.Medium4SimulationString+1No attempts yet1s256 MBJudgeable
MultigramDecide whether the word splits into two or more equal anagram blocks and print the shortest such block, or -1.Medium4StringHash mapNo attempts yet1s64 MBJudgeable
Ignore all my comments (Small)Remove every nested /* */ comment block from the document with a single left to right scan and print the rest unchanged.Medium4StackString+1No attempts yet5s512 MBJudgeable
Ignore all my comments (Large)Remove every nested /* */ comment block from the document in a single left-to-right pass and print the remaining text unchanged.Medium4StackString+1No attempts yet5s512 MBJudgeable
Recycled Numbers (Small)Count pairs (n, m) in [A, B] with equal digits where m is a rotation of n with no leading zero.Medium4Brute forceStringNo attempts yet5s512 MBJudgeable
Irregular Expressions (Small)Decide if any substring of each short lowercase string splits into matching outer words with two or more vowels around a middle word with at least one vowel.Medium4Brute forceStringNo attempts yet5s512 MBJudgeable
Welcome to Code Jam (Small)Count how many ways the 19-character phrase "welcome to code jam" appears as a subsequence of the input line, and print the last four digits.Medium4Dynamic programmingStringNo attempts yet5s512 MBJudgeable
Bit Friendship IndexGiven two equal-length binary strings, find the minimum number of digit changes and character swaps to make them identical.Medium4StringGreedy+1No attempts yet1s128 MBJudgeable
Infinite stringGiven two strings of length at most 50, decide whether each repeated infinitely produces the same infinite string.Medium4StringString matchingNo attempts yet2s512 MBJudgeable
DNA PasswordCount the length-|P| substrings of a DNA string that contain at least the required number of each of A, C, G, and T.Medium4Sliding windowString+2No attempts yet2s512 MBJudgeable
AB StringFind the length-N A/B string whose number of (A before B) pairs equals K, choosing the lexicographically smallest such string.Medium4GreedyCombinatorics+1No attempts yet2s512 MBJudgeable
North North WestA direction string is built from copies of north and west; each prefix copy shifts the angle by 90/2^n, so compute the resulting angle as an integer or reduced fraction.Medium4MathString+2No attempts yet8s512 MBJudgeable
Random Number CheckFor each of N numbers decide whether no digit repeats four times in a row and every divisor greater than 1 exceeds K.Medium4MathNumber theory+2No attempts yet1s64 MBJudgeable
Roman numeral conversionFor each of T inputs, convert a Roman numeral to its value in Arabic numerals or an Arabic numeral between 1 and 3999 to its Roman form.Medium4StringImplementation+2No attempts yet1s128 MBJudgeable
Prefix ArraySort all prefixes of a string lexicographically and print the end index of each prefix in that order.Medium4SortingString+1No attempts yet2s512 MBJudgeable
Card StringGiven uppercase letters taken left to right, each new card is placed at the front or back of the growing string; find the lexicographically smallest result.Medium4GreedyString+2No attempts yet1s256 MBJudgeable
Battle SimulationRead a monster attack string and output the mech's counters, merging each earliest triple of R, B, L into one C.Medium4StackString+1No attempts yet2s512 MBJudgeable
SonnetsFor each poem, reduce every line to the vowel sequence after its last stressed syllable and label lines by first occurrence to build a rhyme scheme.Medium4StringHash map+2No attempts yet2s512 MBJudgeable
Fridge MagnetsGiven a multiset of digit magnets, find the smallest positive integer that cannot be assembled from them, where the answer can exceed 64-bit range.Medium4GreedyMath+2No attempts yet2s512 MBJudgeable
Periodic StringsGiven a string, find the smallest k such that cutting it into blocks of length k makes each block a one-step rotation of the previous block.Medium4StringBrute force+2No attempts yet2s512 MBJudgeable
PalindromesFor each string, find the leftmost single-character deletion that leaves a palindrome, or report that none exists.Medium4StringTwo pointers+2No attempts yet2s512 MBJudgeable
Appearance AnalysisGiven a grid of brick separators and windows, count how many distinct window designs exist, where rotations by multiples of 90 degrees count as the same design.Medium4ImplementationMatrix+2No attempts yet1s512 MBJudgeable
Hidden PalindromeGiven a word of at most 40 lowercase letters, find the longest palindromic subsequence obtainable by deleting letters from the front and back.Medium4Dynamic programmingString+2No attempts yet2s512 MBJudgeable
R9KRemove known nicknames and collapse whitespace in each message, then report whether the resulting text has appeared before.Medium4StringHash map+2No attempts yet2s512 MBJudgeable
Close Match (Small)Fill in the question marks in two equal-length digit strings to minimize the absolute difference between the values, breaking ties by minimizing the first then the second.Medium4Brute forceImplementation+2No attempts yet5s512 MBJudgeable
The Last Word (Large)Insert each letter of S at the front or back of the growing word so the final string is as large as possible lexicographically.Medium4GreedyString+1No attempts yet5s512 MBJudgeable
Revenge of the Pancakes (Small)Given a stack of pancakes as a + and - string, find the fewest top-prefix flips that make every pancake happy side up.Medium4GreedyStringNo attempts yet5s512 MBJudgeable
Revenge of the Pancakes (Large)Given a stack of pancakes as a string of + and -, find the minimum number of top-prefix flips needed to make every pancake show its happy side.Medium4GreedyString+1No attempts yet5s512 MBJudgeable
OvertimeGiven timestamped enter and leave records, count overtime as unmatched leaves plus unmatched enters per name after pairing.Medium4Hash mapStack+2No attempts yet2s512 MBJudgeable
Yin and Yang StonesGiven a circular string of black and white stones, decide whether repeated merges can reduce it to one black and one white stone.Medium4StringGreedy+1No attempts yet2s512 MBJudgeable
Bovine Genomics (Silver)Count triples of genome positions where no spotty cow and plain cow share the same three characters.Medium4Brute forceHash map+2No attempts yet2s512 MBJudgeable
Secret Chamber at Mount RushmoreGiven directed letter translations, decide for each pair of words whether every letter of the first can reach the matching letter of the second.Medium4GraphDFS+2No attempts yet1s512 MBJudgeable
Party GamesFor each test case, find the shortest string that splits the sorted guest names into two equal halves, choosing the alphabetically first if several have that length.Medium4StringSorting+1No attempts yet2s512 MBJudgeable
Almost Identical ProgramsGiven two program strings, decide whether they are identical, differ only in one string literal at the same position, or are otherwise different.Medium4StringImplementation+1No attempts yet2s512 MBJudgeable
Clever TitleFor each uppercase word, count how many orderings of the n author names let you pick one uppercase letter from each name, left to right, to spell the word.Medium4BacktrackingBrute force+2No attempts yet5s512 MBJudgeable
Programming ExamFor each query, decide whether two given substrings of S are anagrams, printing DA or NE.Medium4Prefix sumHash map+1No attempts yet3s128 MBJudgeable
Big Integer A+BRead two integers up to 10^10000 in magnitude and print their sum without using built-in big integer support.Medium4ImplementationString+2No attempts yet1s512 MBJudgeable
Binary CountingGenerate the binary representation of each non-negative integer in order, concatenate the digits, and print every n-th digit starting at position k (five of them).Medium4ImplementationMath+2No attempts yet1s32 MBJudgeable
Human-Computer InteractionCount how often a given lowercase letter appears inside each query interval [l, r] of a fixed string S, answering up to 200,000 queries.Medium4Prefix sumArray+1No attempts yet1s256 MBJudgeable
Repetitive PalindromeGiven a lowercase string s and integer k, decide if t formed by concatenating k copies of s is a palindrome.Medium4StringMath+1No attempts yet1s1024 MBJudgeable
Make the Largest NumberGiven up to 1000 non-negative integers, order the pieces so their concatenation is the largest possible number, and print it without leading zeros.Medium4GreedySorting+1No attempts yet2s512 MBJudgeable
String DiscriminationGiven a target string S and up to 100 words, decide whether S is a concatenation of words from the list, each reusable any number of times.Medium4Dynamic programmingString+1No attempts yet2s512 MBJudgeable
Rational RatioConvert a decimal with a repeating rightmost digit block into a fully reduced fraction formed by integer subtraction.Medium4MathNumber theory+2No attempts yet2s512 MBJudgeable
Devil GameFind a dictionary word containing the original word as a subsequence and maximize mood-killing degree per inserted letter, breaking ties by input order.Medium4StringTwo pointers+1No attempts yet1s256 MBJudgeable
Digits Are Not Just CharactersCompare each name with s0 by splitting into letter and number items, then output "-" if it sorts before s0 or "+" otherwise.Medium4StringSorting+1No attempts yet2s512 MBJudgeable
GuruGuruCount disjoint substrings of an L/R command string that complete one full clockwise rotation from north with the required non-north directions visited.Medium4StringGreedy+1No attempts yet2s512 MBJudgeable
An I for an EyeApply a fixed table of text abbreviations to each line, scanning left to right and always taking the longest match at a position, with case handling.Medium4StringSimulation+2No attempts yet2s512 MBJudgeable
SubtitlesParse a partial SRT file, add a given number of milliseconds to every timestamp, and reprint the blocks in the same format.Medium4StringImplementation+2No attempts yet1s512 MBJudgeable
Cipher DecoderCheck whether the multiset of integers in the ciphertext matches the multiset of character codes of the given plaintext.Medium4Hash mapSorting+2No attempts yet1s512 MBJudgeable
Jinwoo's PasswordGiven N and a lowercase password of length at most N, find its 1-based position among all strings of length 1 to N in lexicographic order.Medium4StringMath+2No attempts yet1s256 MBJudgeable
Magician Nam JeonghunApply a sequence of up to 10 million suit-changing and rotation commands to 26 cards, printing the arrangement whenever a show command appears.Medium4ImplementationString+2No attempts yet1s256 MBJudgeable
Making a PasswordGiven two uppercase strings, find the longest substring that appears in both strings; the answer is unique.Medium4StringBrute force+1No attempts yet1s256 MBJudgeable
Taebo Taebo Punch BarrageReads an ASCII art scene of a face with fist afterimages and counts how many remain on the left and right sides.Medium4StringImplementationNo attempts yet1s256 MBJudgeable
EnigmaImplement a simplified Enigma machine whose two rotors advance together after each letter, and decrypt the given uppercase ciphertext using the rotor setting CHICKENS.Medium4SimulationImplementation+2No attempts yet1s256 MBJudgeable
Bit OverflowGiven an N-digit binary number K, count how many times the operation K = K - (K & ((~K)+1)) can be applied before K becomes 0.Medium4Bit manipulationMath+2No attempts yet1s512 MBJudgeable
Jung's RestaurantDecide whether a customer's order satisfies the restaurant rules: special items need 20000+ in regular items, service items need 50000+ combined and at most one.Medium4Hash mapImplementation+2No attempts yet1s256 MBJudgeable
Last WordGiven a string and a sequence of substring(start, length) operations, output the characters that survive after all operations are applied in order.Medium4StringSimulation+2No attempts yet1s512 MBJudgeable
GPAGiven a catalog of courses with units, major requirements, and each student's grades, print each student's overall GPA and the GPA for every major whose requirements they completed.Medium4Hash mapString+2No attempts yet2s512 MBJudgeable
Make America Grade AgainGiven category weights and a list of graded assignments, sum points per category, weight each fraction, and print the truncated final grade.Medium4MathImplementation+2No attempts yet1s512 MBJudgeable
Problem ClassificationCount exact whole-word occurrences of each category's keywords in a statement, then print the categories with the highest total count in lexicographic order.Medium4Hash mapString+2No attempts yet1s512 MBJudgeable
ABBGiven a string of colors, find how many characters must be appended at the end so the resulting string becomes a palindrome.Medium4StringString matching+2No attempts yet2s512 MBJudgeable
Umm CodeConcatenate u and m characters from words made only of u, m, and punctuation, then decode each 7-bit chunk as ASCII.Medium4StringImplementation+2No attempts yet2s512 MBJudgeable
Where Am I?Given a string of N mailbox colors, find the smallest K such that all length-K substrings are distinct. The answer is always at most N.Medium4StringBrute force+2No attempts yet1s512 MBJudgeable
Valid EmailsNormalize each email by its rules, count how many are valid and distinct.Medium4StringHash map+2No attempts yet2s512 MBJudgeable
Mad ScientistGiven two strings A and B of H and G, find the minimum number of substring flips (toggling all characters) needed to turn B into A.Medium4GreedyString+2No attempts yet2s512 MBJudgeable
RepetitionGiven a lowercase string S, find the smallest K such that S is a subsequence of the alphabet repeated K times.Medium4GreedyString+1No attempts yet1s256 MBJudgeable
Cyber Opening CeremonyGiven start, end, and stream-end times plus chat logs, count members who chatted at or before the start and again between the end and stream-end.Medium4Hash mapImplementation+2No attempts yet1s1024 MBJudgeable
Checking Answers to TestGiven the correct answers and each student's answers, find every pair of students whose correct and incorrect answers each match on more than half of the questions.Medium4Brute forceImplementation+2No attempts yet1s512 MBJudgeable
Hamburger DistributionAlong a line of N positions holding people and hamburgers, each person can eat a hamburger within distance K; find the maximum number of people served.Medium4GreedyTwo pointers+2No attempts yet0.5s256 MBJudgeable
LampsGiven an N by M lamp grid where pressing a column switch exactly K times total flips columns, find the max number of rows that end up fully lit.Medium5Hash mapString+2No attempts yet2s128 MBJudgeable
Base-36 NumberPick K base-36 digit symbols to replace with Z across N numbers so their sum is maximized, then output that sum in base 36.Medium5GreedyMath+2No attempts yet2s128 MBJudgeable
Digit SwapGiven N and exactly K digit swaps that must never leave a leading zero, find the maximum resulting number or report -1 if impossible.Medium5BFSBrute force+2No attempts yet2s128 MBJudgeable
Tower Floor DisplayGiven an N-digit floor number shown on a lamp display where off lamps may be broken, compute the average of every floor number consistent with the lit lamps.Medium5MathCombinatorics+2No attempts yet2s128 MBJudgeable
Unknown SentencePartition a sentence into segments that are anagrams of given words, minimizing total letters moved from their original word positions.Medium5Dynamic programmingString+1No attempts yet2s128 MBJudgeable
Digit 8Given L and R up to 2*10^9, find the minimum number of times digit 8 appears in any integer within [L, R].Medium5MathGreedy+1No attempts yet2s512 MBJudgeable
Maximum SumAssign digits 0-9 to letters A-J that encode N numbers so that the sum of the numbers is maximized while no number has a leading zero.Medium5GreedyMath+2No attempts yet2s128 MBJudgeable
PrefixGiven up to 50 words, find the largest subset where no word is a prefix of another, using a trie and tree DP.Medium5TrieDynamic programming+2No attempts yet2s128 MBJudgeable
AdvertisementGiven the L characters currently visible on a scrolling sign showing an infinitely repeated text, find the minimum possible length of the original advertisement text.Medium5String matchingStringNo attempts yet2s128 MBJudgeable
Two String MasksGiven two strings each containing one asterisk, find the shortest string obtainable by replacing the asterisks with (possibly empty) letter strings so both become equal, or report impossible.Medium5StringSimulation+2No attempts yet2s128 MBJudgeable
UnderscoresInsert underscores between N given words (counts differing by at most 1) to reach total length M, and output the lexicographically smallest resulting string under a custom character order.Medium5GreedyString+1No attempts yet2s128 MBJudgeable
Make a Periodic StringGiven a DNA string and a bound M, find the minimum number of character edits to make the string periodic with some period length at most M.Medium5StringGreedy+2No attempts yet2s128 MBJudgeable
Substring Picking GamePlayers alternately subtract a value formed by a proper substring of the current number's digits, and you must find the smallest first move that forces a win, or -1 if none exists.Medium5Game theoryDynamic programming+2No attempts yet2s256 MBJudgeable
String ExchangeGiven a circular string of a's and b's, find the minimum number of swaps to make all a's form one consecutive block.Medium5Sliding windowString+2No attempts yet2s128 MBJudgeable
Making a PalindromeFind the minimum number of integers to insert into a sequence so it becomes a palindrome, using interval or LCS-based dynamic programming.Medium5Dynamic programmingArray+1No attempts yet2s128 MBJudgeable
Text FormalizationExpand every contraction and the first occurrence of each acronym in a text, following case rules and leftmost-earliest matching priority.Medium5StringString matching+2No attempts yet1s128 MBJudgeable
Word ExtensionGiven a dictionary and a starting 3-letter word, find the longest word reachable by repeatedly inserting one letter such that each intermediate word exists in the dictionary.Medium5Dynamic programmingString+1No attempts yet2s128 MBJudgeable
Removing ParenthesesGiven an arithmetic expression with letters and +,-,*,/,() parse it and print an equivalent expression using the fewest parentheses, applying sign/operator flips when parentheses are removed.Medium5RecursionString+1No attempts yet2s128 MBJudgeable
Similar WordsGiven up to 20,000 distinct words, find the pair with the longest common prefix, breaking ties by input order.Medium5StringSorting+1No attempts yet2s128 MBJudgeable
Letter BoardCount the number of paths on an N by M letter grid that spell a given word, moving 1 to K cells in one straight direction per step.Medium5Dynamic programmingMatrix+1No attempts yet2s128 MBJudgeable
String CopyFind the minimum number of substring-copy operations from S needed to reconstruct P using greedy/DP over matching positions.Medium5Dynamic programmingString+1No attempts yet2s128 MBJudgeable
Fax CompressionChoose a quantization of a sequence into 4 levels with run-length style bit encoding to minimize error plus weighted code length.Medium5Dynamic programmingString+1No attempts yet2s128 MBJudgeable
Crossing the Stone BridgesCount ways to match a scroll string to positions across two parallel bridge strings, alternating bridges and strictly increasing positions.Medium5Dynamic programmingStringNo attempts yet1s128 MBJudgeable
Submarine IdentificationDecide whether a binary string can be split into pieces of '01' or '1' followed by at least two 0s and at least one 1, using pattern matching or DP.Medium5Dynamic programmingString matching+1No attempts yet1s128 MBJudgeable
Building EDSAC InstructionsConvert a decimal fraction into two's-complement binary and print it as an EDSAC assembly instruction, rounding toward zero and detecting out-of-range values.Medium5Bit manipulationString+2No attempts yet1s128 MBJudgeable