KatInterview

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 31–60 of 187 results

  • StringsMediumAuto-graded
    Tally Slices Whose Letters Are All Different

    Count every contiguous slice of a lowercase string in which no letter appears twice, using a linear-time sliding window.

    Stringssliding-windowtwo-pointersstringscounting
  • StringsMediumAuto-graded
    Rolling Up Page Views Through Hostname Suffixes

    Aggregate per-host view counts so every host and each of its parent suffixes gets the total of itself and all hosts beneath it, using suffix enumeration and a hash map.

    Stringshash-mapstringsparsingsuffix-enumeration
  • StringsEasyAuto-graded
    Encode Keypad Multi-Tap Strokes

    Simulate telephone keypad multi-tap text encoding while inserting pause delimiters for consecutive letters on the same digit key.

    Stringsstringshash-tablesimulation
  • StringsMediumAuto-graded
    Validate a Plain Signed Decimal Literal

    Check whether a string is a well-formed plain decimal literal (optional sign, digits, optional fraction) by turning a small grammar into a careful single-pass validator.

    Stringsstringsparsingvalidationedge-cases
  • StringsEasyAuto-graded
    Reassemble Framed Messages from Chunked Byte Streams

    Join byte chunks from a simulated stream and split them into complete messages, using either a 4-byte length prefix or newline delimiters, while ignoring any incomplete tail.

    Stringsbyte-streamparsingframingbuffering
  • StringsMediumAuto-graded
    Evaluate a Nested Let/Add/Mult Expression, or Report Invalid

    Tokenize, validate and evaluate a small Lisp-like language with scoped let bindings, returning None for any malformed or ill-formed input.

    Stringsparsingrecursionscopestring-processing
  • StringsMediumAuto-graded
    Max Overlap of String Suffix and Prefix

    Find the maximum length of a suffix of one string that matches a prefix of another.

    Stringsstringskmpprefix-functiontwo-pointers
  • StringsEasyAuto-graded
    Stitch Glyph Rows Into a Banner

    Combine per-character row strings from a font table into banner lines by joining row i of every glyph in order.

    Stringsstringssimulationhash-mapjoin
  • StringsMediumAuto-graded
    Evaluate Arithmetic String Without Parentheses

    Parse and compute a non-negative integer arithmetic string with basic binary operators while preserving standard precedence and left-to-right evaluation.

    Stringsstringsparsingstacks-queuesmath-bits
  • StringsEasyAuto-graded
    Find the First Near-Match Code With Optional Folding Rules

    Scan candidate codes in order and return the first whose normalized form is within a mismatch limit of a reference, using optional case folding and O/0, I/1 merging.

    Stringsstringshamming-distancenormalizationsimulation
  • StringsMediumAuto-graded
    Leftmost Longest Mirror-Reading Substring

    Find the longest contiguous substring that reads the same in both directions, returning the leftmost one on ties; tests center expansion or Manacher-style reasoning.

    Stringsstringspalindrometwo-pointersmanacher
  • StringsMediumAuto-graded
    Shared-Letter Splits and Best Uniform Bundles

    Count string split points whose halves share more than k distinct characters, and find the most equal-total bundles of one or two items from a cost list, with a special rule for zero-cost items.

    Stringsstringshash-mapcountingprefix-suffix
  • StringsMediumAuto-graded
    Expand a Compact Letter-and-Count String

    Parse a string of letters with optional multi-digit repeat counts, treating a missing count as one, and rebuild the expanded text in a single left-to-right pass.

    Stringsstring-parsingtwo-pointerssimulationrun-length-encoding
  • StringsMediumAuto-graded
    Fill Placeholders in a Chained Request Template

    Recursively resolve {{dotted.path}} placeholders in a nested request, keeping native types for whole-string matches and stringifying embedded ones.

    Stringsrecursionregexjsontemplate-substitution
  • StringsEasyAuto-graded
    Rearrangement Check Using Letter Tallies, No Sorting

    Decide whether two lowercase strings are rearrangements of each other using letter frequency counting in linear time, without sorting.

    Stringsstringshash-tablefrequency-countanagram
  • StringsMediumAuto-graded
    Corridor Run With Matching Keys and Locked Doors

    Find the fewest moves along a 1D corridor with walls, keys and doors, and notice that the state space collapses to a simple prefix scan.

    Stringsbfsbitmaskstring-scanstate-space
  • StringsMediumAuto-graded
    Longest Unique Sequence of Media Titles

    Find the maximum length of a contiguous subsequence of string titles containing no duplicated elements using a dynamic sliding window approach.

    Stringssliding-windowhash-tablestringsarrays
  • StringsMediumAuto-graded
    Reconstruct IPv4 Addresses from Digit Sequence

    Parse a string of numeric digits into all possible valid four-part IPv4 address representations.

    Stringsstringsbacktrackingparsing
  • StringsMediumAuto-graded
    Compressed Word Check Plus Bracket Matching

    Tests two linear scans in one function: validating a numeric-skip word abbreviation with two pointers, and checking nested bracket balance with a stack.

    Stringstwo-pointersstackstring-parsingvalidation
  • StringsMediumAuto-graded
    Order Distinct Letters-Only Tokens by Popularity

    Extract case-insensitive ASCII-letter tokens from text, count them, and list the distinct words by descending count with alphabetical tie-breaks.

    Stringshash-mapstring-parsingsortingfrequency-count
  • StringsEasyAuto-graded
    Name the CSS Function for Red-Green-Blue With Optional Alpha

    Recall which CSS color function takes red, green and blue channels plus an optional opacity value, and return its canonical name as a string.

    Stringscssfundamentalstriviastring-return
  • StringsMediumAuto-graded
    Does This Shorthand Describe the Word?

    Check whether a shorthand of letters and skip counts exactly describes a word, handling multi-digit counts, leading zeros, overruns and leftover characters with a two-pointer scan.

    Stringstwo-pointersstring-parsingsimulation
  • StringsEasyAuto-graded
    Earliest Non-Repeating Character with Optional Case Folding

    Find 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.

    Stringsstringshash-mapcountingcase-folding
  • StringsMediumAuto-graded
    List Every Well-Formed Bracket Sequence in Dictionary Order

    Enumerate all well-formed bracket sequences using n pairs, returned in dictionary order, testing pruned backtracking and reasoning about output ordering.

    Stringsbacktrackingrecursioncombinatoricsstrings
  • StringsHardAuto-graded
    Build a Recursive-Descent Decoder for a JSON Subset

    Write a strict recursive-descent parser that turns JSON text into Python values and raises ValueError on any malformed input.

    Stringsparsingrecursive-descentstringsrecursion
  • StringsMediumAuto-graded
    Bracket Depth Scoring of a Nested Integer String

    Scan a bracketed string of non-negative integers and sum each integer times its bracket nesting level, handling multi-digit numbers, whitespace and empty lists.

    Stringsstring-parsingnested-structuressingle-passbracket-depth
  • StringsHardAuto-graded
    Fewest Neighbor Swaps to Mirror a Word

    Compute the minimum number of adjacent character swaps needed to rearrange a lowercase string into a palindrome, or report -1 if no palindrome is possible.

    Stringsgreedytwo-pointersstringspalindrome
  • StringsEasyAuto-graded
    Match Words to a Keypad Number Sequence

    Given 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.

    Stringsstringshashingsortingsimulation
  • StringsEasyAuto-graded
    Earliest Non-Repeating Symbol Position

    Locate the index of the earliest symbol in an alphanumeric string that occurs only once, using frequency counting and an ordered scan, or return -1.

    Stringshash-mapcountingstringtwo-pass
  • StringsEasyAuto-graded
    Run Strings Through a Two-Letter State Machine

    Simulate 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.

    Stringssimulationhash-mapstate-machinestrings