KatInterview

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

Strings Interview Problems

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

5971
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 61–90 of 187 results

  • StringsMediumAuto-graded
    Longest Window Where Every Letter Meets a Minimum Count

    Find the longest contiguous substring in which every letter that appears occurs at least k times, using a sliding window or divide and conquer.

    Stringssliding-windowstringshash-mapdivide-and-conquer
  • StringsMediumAuto-graded
    Longest Stretch of Non-Repeating Characters

    Find the length of the longest contiguous run in a string where every character is distinct, using a linear-time sliding window with index tracking.

    Stringssliding-windowhash-maptwo-pointersstrings
  • StringsMediumAuto-graded
    Longest Word That Swallows Another Word in the List

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

    Stringsstringssubstringsortinghash-set
  • StringsEasyAuto-graded
    Minimum Replacements to Eliminate Consecutive Equal Triples

    Find the total minimum number of character modifications required to prevent any character from repeating 3 or more times consecutively across a collection of strings.

    Stringsstringsgreedy
  • StringsEasyAuto-graded
    Filter Valid Credit Card Numbers

    Validate a list of card number strings against length, prefix, digit-only, and Luhn checksum requirements.

    Stringsstringsarrays
  • StringsEasyAuto-graded
    Parse Hex Color Code to ARGB Integer

    Parse a hex color string (6 or 8 characters) into a 32-bit ARGB packed integer, returning a fallback on invalid input.

    Stringsstringsparsingmath-bits
  • StringsEasyAuto-graded
    Longest Streak of a Repeated Character in a String

    Scan a string once to find the longest streak of adjacent equal characters, keeping separated streaks distinct and using only constant extra memory.

    Stringsstringstwo-pointerslinear-scanstate-tracking
  • StringsEasyAuto-graded
    Max Length Product of Non-Overlapping Disjoint-Alphabet Substrings

    Find the maximum product of lengths of two non-overlapping substrings that do not share any characters.

    Stringsstringsmath-bitsarrays
  • StringsMediumAuto-graded
    Score a Guess Against a Hidden Word with Exact and Shifted Hits

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

    Stringsstringshashingfrequency-countingsimulation
  • StringsEasyAuto-graded
    Count Case-Sensitive Occurrences in a Text

    Count how many times a target character, or substring, appears in a text under case-sensitive, non-overlapping matching.

    Stringsstringscountingsubstringcase-sensitive
  • StringsMediumAuto-graded
    Find Minimum Substring with K Distinct Characters

    Determine the length of the shortest contiguous substring that contains a target count of unique lowercase letters using a sliding window technique.

    Stringssliding-windowstringstwo-pointershash-table
  • StringsEasyAuto-graded
    Render Payment Records as Boxed Receipt Cards

    Turn a list of parsed payment records into fixed-layout text cards, testing whitespace trimming, exact decimal rounding, and precise string formatting while preserving order.

    Stringsstring-formattingdecimalparsingsimulation
  • StringsMediumAuto-graded
    Group Digits of a Signed Integer with a Custom Delimiter

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

    Stringsstringsmathformattingdigit-extraction
  • StringsEasyAuto-graded
    Fill In Percent-Delimited Tokens From a Lookup Table

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

    Stringsstringsparsinghash-maptwo-pointers
  • StringsMediumAuto-graded
    Every Window of Length Three or More Must Be a Known Word

    Check that every contiguous substring of length at least 3 appears in a word list, testing set-based lookups, loop bounds and the vacuous case for short strings.

    Stringsstringshash-setsubstringsenumeration
  • StringsMediumAuto-graded
    Centered Pascal Pyramid Renderer

    Build the first n rows of Pascal's triangle and render them as a centered text pyramid with fixed-width, right-aligned cells and floor-based indentation.

    Stringspascal-trianglestring-formattingsimulationmath
  • StringsMediumAuto-graded
    Even-Width Paragraph Formatter

    Greedily pack words into lines of a fixed width, then pad each line with spaces so it is exactly that wide, handling single-word and final lines separately.

    Stringsstringsgreedysimulationtext-justification
  • StringsMediumAuto-graded
    Check Whether a Token Is a Well-Formed Decimal Literal

    Scan a string once to decide if it matches a small decimal-literal grammar with optional sign, a dotted mantissa and an optional exponent, handling many edge cases.

    Stringsstring-parsingstate-machinevalidationedge-cases
  • StringsMediumAuto-graded
    Boxed Multi-Width Paragraph Formatter

    Greedily word-wrap each paragraph to its own width, then frame all resulting lines in one padded ASCII box sized by the widest paragraph limit.

    Stringsstringssimulationgreedytext-formatting
  • StringsMediumAuto-graded
    Squash Consecutive Letter-Rearrangement Duplicates

    Scan a word list and drop each word that is a letter rearrangement of the previously kept word, testing signature comparison and order-preserving single-pass filtering.

    Stringsstringsanagramssimulationtwo-pointers
  • StringsEasyAuto-graded
    Keypad Digit Sequence Word Filter

    Filter a word list down to the words whose letters, read through a phone keypad, spell out a given digit string, in original order.

    Stringsstringshash-mapfilteringsimulation
  • StringsMediumAuto-graded
    Left-to-Right Calculator Using Only Scalar State

    Evaluate a no-parentheses arithmetic string with correct precedence and truncating division in one pass, using only a few scalar variables instead of a stack.

    Stringsstring-parsingtwo-pointerssimulationconstant-space
  • StringsMediumAuto-graded
    Fewest Leading Digits Needed to Rearrange Into Each Word

    For each query digit string, find the shortest prefix of a digit string containing enough of each digit to form it, using per-digit occurrence lists and a max over digits.

    Stringsstringshashingcountingprecomputation
  • StringsEasyAuto-graded
    Decode an Ancient Numeral String into a Number

    Parse a valid Roman numeral string into its integer value by handling additive symbols and the six subtractive pairs.

    Stringsstringshash-mapparsingsimulation
  • StringsMediumAuto-graded
    Shrink Repeated Letters into Letter-Count Pairs

    Encode each maximal run of equal letters as the letter plus its decimal count, and fall back to the input when the encoding is not strictly shorter.

    Stringsstringstwo-pointersrun-length-encodingsimulation
  • StringsMediumAuto-graded
    Decode a Hex String into a Dotted-Quad Network Address

    Validate a strict 8-digit hex string with an optional 0x prefix and convert it into dotted-decimal IPv4 form, treating the leftmost byte as the first octet.

    Stringsstringsparsingvalidationhexadecimal
  • StringsEasyAuto-graded
    Report SQL Clauses in Conceptual Evaluation Order

    Detect which of six SQL clauses appear in a query string and return them in SQL-92 logical evaluation order, using case-insensitive whole-word matching.

    Stringsstringsregexsqlparsing
  • StringsMediumAuto-graded
    Mask the Leftmost Longest Keyword in a Text

    Find the earliest-starting match among several keywords, prefer the longest at that spot, and collapse it into a single placeholder character.

    Stringsstringsstring-matchingsimulationtrie
  • StringsMediumAuto-graded
    Fewest Source Slices to Spell a Target

    Find the minimum number of source substrings whose concatenation equals the target, using longest-match-per-position and a greedy jump pass.

    Stringsstringsgreedysuffix-automatontwo-pointers
  • StringsMediumAuto-graded
    Find a Block Repeated Back-to-Back in a Token List

    Decide whether a list of tokens contains a block of a given length repeated a given number of times in a row, testing period detection with a linear scan.

    Stringsstringsarrayssliding-windowperiodicity