practice a little every day — you've got this ♡
Strings Interview Problems
Practice 5969 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.
- 5969
- Problems
- 2211
- Auto-graded
- 15
- Topics
- 273
- Added today
Showing 1–30 of 187 results
- StringsMediumAuto-gradedLetter-Grid Feedback for a Hidden Word Guess
Score a guess against a hidden word with exact, misplaced, and absent marks, handling repeated letters correctly and rejecting invalid input.
Stringsstringshash-mapcountingtwo-pass - StringsMediumAuto-gradedAlphabetically Greatest Tail of a String
Find the lexicographically greatest suffix of a long lowercase string in linear time by comparing candidate start positions without copying and skipping eliminated blocks.
Stringsstringstwo-pointersgreedysuffix - StringsEasyAuto-gradedPick the Tightest Wildcard Mask for a Bit String
Scan a list of 0/1/? templates, keep those that fit a bit string, and return the one with the fewest wildcards, breaking ties by earliest position.
Stringsstringspattern-matchinglinear-scantie-breaking - StringsEasyAuto-gradedQuery-Driven Text Wrapper with Last-Line Balancing
Parse a URL query string by hand, then greedily wrap the text to a width and fix a lone last-line word by borrowing from the previous line.
Stringsstring-parsinggreedysimulationtext-wrapping - StringsMediumAuto-gradedLongest Window With a Capped Number of Distinct Letters
Find the length of the longest contiguous stretch of a string using no more than k different characters, testing the sliding-window technique with a frequency map.
Stringssliding-windowtwo-pointershash-mapstrings - StringsEasyAuto-gradedValid Palindrome with At Most One Removal
Determine whether a given string can be converted into a palindrome by removing no more than one character.
Stringsstringstwo-pointers - StringsMediumAuto-gradedSpoken Amount Decoder: English Words to Signed Integer
Parse an English number phrase (up to millions, optional "negative" prefix) into its integer value using a single left-to-right pass with group accumulators.
Stringsstring-parsingtokenizationhash-mapsimulation - StringsEasyAuto-gradedAccess Log Health Report with Strict Line Validation
Validate access-log lines field by field, then count client errors, server errors, invalid lines and the failure percentage over the valid lines only.
Stringsstringsparsingvalidationsimulation - StringsMediumAuto-gradedFewest Letter Swaps to Rearrange One Word Into Another's Letters
Count letter frequencies in two equal-length strings to find the fewest in-place letter replacements that make the second string an anagram of the first.
Stringsstringshash-mapfrequency-countinganagram - StringsEasyAuto-gradedMirror Check Ignoring Punctuation and Letter Case
Check whether a string is a palindrome when only letters and digits count and case is ignored, using two pointers with constant extra space.
Stringstwo-pointersstringspalindrome - StringsMediumAuto-gradedMinimal Distinguishing Abbreviations for a Word List
Compute, for each word, the shortest leading substring shared with no other entry, using prefix counting or a trie, and return the whole word when none exists.
Stringstrieprefixhash-mapstrings - StringsMediumAuto-gradedWords Spelled by a Finger Trace Across Keys
Find all dictionary words that fit a key trace as a start- and end-anchored subsequence where letters may reuse a key, using a next-occurrence table to match many words efficiently.
Stringsstringssubsequencegreedyprecomputation - StringsMediumAuto-gradedResolve Nested %NAME% Placeholders with Cycle Detection
Expand %NAME% placeholders whose values may reference other placeholders, handling %% escapes, missing names, and circular references.
Stringsparsingdfsmemoizationcycle-detection - StringsMediumAuto-gradedEarliest Second the Secret Is Beyond Repair
Find the first second at which at least m substrings of a string contain a corrupted character, using complement counting and a reverse-time merge of clean runs.
Stringsstringsunion-findcountingreverse-simulation - StringsMediumAuto-gradedTightest Segment Covering a Required Letter Multiset
Find the shortest contiguous piece of a text that includes all letters of a target, with repeats and case mattering, using a sliding window with counts and earliest-start tie-breaking.
Stringssliding-windowtwo-pointershash-mapstrings - StringsEasyAuto-gradedOrdered Symbol Tally by First Occurrence
Count how often each character occurs in a string and report the tallies in the order the characters first appear, treating every character as distinct and significant.
Stringshash-mapstringcountingordered-dict - StringsEasyAuto-gradedElapsed Minutes Since the Latest Bus Pull-Out
Convert clock strings to minutes and find the shortest wrap-around gap back to a past departure, covering unsorted input, duplicates and an empty schedule.
Stringstime-parsingmodular-arithmeticwrap-aroundlinear-scan - StringsEasyAuto-gradedLongest Distinct Run and First Singleton Position
Tests a sliding window with last-seen indices plus a frequency count to find the longest repeat-free substring and the earliest character occurring exactly once.
Stringssliding-windowhash-mapstringsfrequency-count - StringsMediumAuto-gradedFilter Words Expandable to Target String
Determine which words from a dictionary can yield a target string by expanding consecutive duplicate characters in place.
Stringsstringstwo-pointersarrays - StringsMediumAuto-gradedBracket the Shortest Exclusive Fragment in Every Menu Entry
Find, for each string, its shortest substring that occurs in no other string (case-insensitive), with leftmost tie-break, and wrap it in brackets while keeping original casing.
Stringsstringshash-mapsubstringsbitmask - StringsMediumAuto-gradedEarliest Longest Mirror Segment in a String
Find the longest contiguous segment of a string that reads identically in both directions, preferring the leftmost one on ties and returning an empty string for empty input.
Stringsstringspalindromeexpand-around-centertwo-pointers - StringsMediumAuto-gradedLongest Run With No Repeated Character
Find the length of the longest contiguous block of a string with no repeated character, using a linear-time sliding window with exact, case-sensitive comparison.
Stringssliding-windowhash-maptwo-pointersstrings - StringsEasyAuto-gradedCount Balanced Two-Block Binary Substrings
Count substrings of a binary string made of one block of equal characters followed by a block of the other character, with both blocks the same length.
Stringsstringstwo-pointersrun-lengthcounting - StringsMediumAuto-gradedLongest Run Using No More Than Two Letter Kinds
Find the longest contiguous stretch of a string containing at most two different characters, testing the sliding window technique with a frequency map.
Stringssliding-windowhash-maptwo-pointersstrings - StringsEasyAuto-gradedShared Starting Sequence in String Array
Determine the longest initial substring shared across every word in a given list.
Stringsstringsarraysprefix - StringsEasyAuto-gradedScreen Pasted Card Numbers: Format, Issuer Prefix and Luhn
Filter strings by a character and length rule, an issuer-prefix range and the Luhn checksum, returning the original text of each valid entry in input order.
Stringsstringsvalidationluhnsimulation - StringsEasyAuto-gradedKeypad Digit Prefix Word Lookup
Encode words as keypad digit strings and answer many digit-prefix queries quickly using sorted ranges or a trie, returning matches in alphabetical order.
Stringsbinary-searchprefixsortingtrie - StringsMediumAuto-gradedFewest Front-Relocations to Rearrange a String
Count the minimum moves to turn one string into another by moving characters to the front, using a multiset check and a right-to-left greedy subsequence match.
Stringsstringsgreedytwo-pointerssubsequence - StringsMediumAuto-gradedString Array Framing and Round-Trip Encoding
Design a robust serialization scheme that packs a list of arbitrary strings into a single string and successfully reconstructs it without ambiguity.
Stringsstringsarraysdesign-ds - StringsMediumAuto-gradedSplit Text by Longest Dictionary Prefix with Single-Char Fallback
Scan a string left to right, always consuming the longest dictionary word starting at the current position, or one character if none match; tests tries and prefix matching.
Stringstriegreedystring-processingprefix-matching