KatInterview

practice a little every day — you've got this ♡

Strings Interview Problems

Practice 5966 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.

5966
Problems
2209
Auto-graded
15
Topics
271
Added today

Showing 1–30 of 227 results

  • StringsMediumAuto-graded
    Alphabetically 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-graded
    Pick 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-graded
    Query-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-graded
    Longest 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-graded
    Valid 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-graded
    Spoken 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-graded
    Access 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-graded
    Fewest 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-graded
    Mirror 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-graded
    Minimal 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
  • StringsEasyModel answer
    Letter-Match Feedback Widget for a Five-Letter Word Game

    Build a small browser widget that scores a typed guess of up to five letters against a fixed secret word, marking each letter exact, misplaced or absent, with sound input handling.

    Stringsstringsfrontendstate-managementinput-validation
  • StringsMediumAuto-graded
    Words 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-graded
    Resolve Nested %NAME% Placeholders with Cycle Detection

    Expand %NAME% placeholders whose values may reference other placeholders, handling %% escapes, missing names, and circular references.

    Stringsparsingdfsmemoizationcycle-detection
  • StringsMediumModel answer
    String Internals, Move Costs, and Threads vs Async Tasks

    Describe how a string is laid out in memory, what copying and moving really cost, what a Rust move does, and how OS threads differ from async coroutines.

    Stringsstringsmemory-managementmove-semanticsrust
  • StringsMediumAuto-graded
    Earliest 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-graded
    Tightest 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-graded
    Ordered 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-graded
    Elapsed 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-graded
    Longest 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
  • StringsMediumModel answer
    Verify Validity of Piece Movement on a 1D Board

    Determine whether an initial 1D board configuration can reach a target configuration based on specific movement and jump rules.

    Stringsstringstwo-pointersinvariants
  • StringsMediumModel answer
    JavaScript Strict vs Loose Equality: Coercion Rules and Pitfalls

    Explain how JavaScript's two equality operators work, how implicit type coercion drives loose equality, where results diverge, and which operator to prefer.

    Stringsjavascripttype-coercionequalitylanguage-fundamentals
  • StringsMediumAuto-graded
    Filter 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-graded
    Bracket 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-graded
    Earliest 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-graded
    Longest 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-graded
    Count 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-graded
    Longest 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-graded
    Shared Starting Sequence in String Array

    Determine the longest initial substring shared across every word in a given list.

    Stringsstringsarraysprefix
  • StringsEasyAuto-graded
    Screen 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
  • StringsMediumModel answer
    Round a Decimal String Without Using Floats

    Round a decimal number given as a string to the nearest integer, then to its last significant digit, using digit-level arithmetic and carry handling instead of floating-point types.

    Stringsstringscarry-propagationroundingparsing