Topic
Strings interview problems
Parsing, matching, palindromes and string transforms. 228 original problems, each with hidden test cases you can run in the browser.
60 easy155 medium13 hard
Showing 61–90 of 228 results
Round a decimal string to the nearest integer, then to a power-of-ten step such as 100 or 0.1, using only string and digit operations and a clearly stated tie-breaking rule.
Model answerstringsroundingbig-numberscarryFind the position of the earliest character that occurs exactly once in a string, with a flag that switches between case-sensitive and case-insensitive matching.
Auto-gradedstringshash-mapcountingcase-foldingEnumerate all well-formed bracket sequences using n pairs, returned in dictionary order, testing pruned backtracking and reasoning about output ordering.
Auto-gradedbacktrackingrecursioncombinatoricsstringsWrite a strict recursive-descent parser that turns JSON text into Python values and raises ValueError on any malformed input.
Auto-gradedparsingrecursive-descentstringsrecursionScan a bracketed string of non-negative integers and sum each integer times its bracket nesting level, handling multi-digit numbers, whitespace and empty lists.
Auto-gradedstring-parsingnested-structuressingle-passbracket-depthCompute the minimum number of adjacent character swaps needed to rearrange a lowercase string into a palindrome, or report -1 if no palindrome is possible.
Auto-gradedgreedytwo-pointersstringspalindromeGiven a word list and a string of keypad digits, return the sorted words whose letters map to exactly that digit sequence, testing string encoding and filtering.
Auto-gradedstringshashingsortingsimulationAnalyze a poorly designed Java method for generating CSV strings and detail performance, RFC 4180 compliance, memory usage, and security enhancements.
Model answercode-reviewjavastringscsvLocate the index of the earliest symbol in an alphanumeric string that occurs only once, using frequency counting and an ordered scan, or return -1.
Auto-gradedhash-mapcountingstringtwo-passSimulate a partial deterministic automaton over the letters a and b, handling missing transitions, invalid symbols and empty input, and report acceptance for a batch of query strings.
Auto-gradedsimulationhash-mapstate-machinestringsFind the longest contiguous substring in which every letter that appears occurs at least k times, using a sliding window or divide and conquer.
Auto-gradedsliding-windowstringshash-mapdivide-and-conquerFind the length of the longest contiguous run in a string where every character is distinct, using a linear-time sliding window with index tracking.
Auto-gradedsliding-windowhash-maptwo-pointersstringsGiven a target string and a list of words, return every word that becomes the target after swapping at most one pair of characters in that word, keeping input order.
Model answerstringstwo-pointerscharacter-frequencybuddy-stringsFind the longest distinct word in a list that contains a different word from the list as a contiguous substring, with a fixed tie-break and empty-string handling.
Auto-gradedstringssubstringsortinghash-setFind the total minimum number of character modifications required to prevent any character from repeating 3 or more times consecutively across a collection of strings.
Auto-gradedstringsgreedyValidate a list of card number strings against length, prefix, digit-only, and Luhn checksum requirements.
Auto-gradedstringsarraysBuild a browser payment card form where the detected card network drives number formatting, length checks and security-code rules, with validation and a submit callback.
Model answerfrontendform-validationluhninput-formattingParse a hex color string (6 or 8 characters) into a 32-bit ARGB packed integer, returning a fallback on invalid input.
Auto-gradedstringsparsingmath-bitsIdentify words that appear in either of two given text strings, but not in both, using symmetric set difference.
Model answerstringsarraysset-operationsScan a string once to find the longest streak of adjacent equal characters, keeping separated streaks distinct and using only constant extra memory.
Auto-gradedstringstwo-pointerslinear-scanstate-trackingFind the maximum product of lengths of two non-overlapping substrings that do not share any characters.
Auto-gradedstringsmath-bitsarraysCompute exact-position and misplaced letter counts between a guess and a secret using leftover letter counts, with a sentinel for guesses missing from the word list.
Auto-gradedstringshashingfrequency-countingsimulationCount how many times a target character, or substring, appears in a text under case-sensitive, non-overlapping matching.
Auto-gradedstringscountingsubstringcase-sensitiveCheck if a string's characters can form a palindrome, and implement precise addition of non-negative decimal strings without using native floating-point types.
Model answerstringsmath-bitshash-tableTrace three root causes in a minimal template rendering engine—regex greediness, loop parsing, and path traversal—and present targeted fixes with regression tests.
Model answerdebuggingparsingregexsecurityDetermine the length of the shortest contiguous substring that contains a target count of unique lowercase letters using a sliding window technique.
Auto-gradedsliding-windowstringstwo-pointershash-tableTurn a list of parsed payment records into fixed-layout text cards, testing whitespace trimming, exact decimal rounding, and precise string formatting while preserving order.
Auto-gradedstring-formattingdecimalparsingsimulationBuild a string from a signed 64-bit integer, placing a delimiter between each group of three digits from the right, with the minus sign kept in front, using manual digit handling.
Auto-gradedstringsmathformattingdigit-extractionScan a string left to right, replacing each %key% token with its mapped value and returning None when a key is missing; tests careful linear string parsing.
Auto-gradedstringsparsinghash-maptwo-pointersAudit a short Python function that flattens rows into CSV text, list its correctness and performance flaws with triggering inputs, and rewrite it safely and efficiently.
Model answercode-reviewcsvpythonstring-building