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 61–90 of 228 results

  • StringsEasyModel answer
    Round Decimal Strings to a Power-of-Ten Step, No Floats

    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.

    Stringsstringsroundingbig-numberscarry
  • 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
  • StringsMediumModel answer
    Java Code Review: Refactoring a CSV Generator

    Analyze a poorly designed Java method for generating CSV strings and detail performance, RFC 4180 compliance, memory usage, and security enhancements.

    Stringscode-reviewjavastringscsv
  • 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
  • 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
  • StringsMediumModel answer
    Filter Words Reachable From a Target by One Character Swap

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

    Stringsstringstwo-pointerscharacter-frequencybuddy-strings
  • 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
  • StringsMediumModel answer
    Linked-Field Payment Card Form with Live Validation

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

    Stringsfrontendform-validationluhninput-formatting
  • 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
  • StringsEasyModel answer
    Find Unique Words Across Two Text Blocks

    Identify words that appear in either of two given text strings, but not in both, using symmetric set difference.

    Stringsstringsarraysset-operations
  • 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
  • StringsMediumModel answer
    Validate Palindrome Rearrangements and Sum High-Precision Decimals

    Check if a string's characters can form a palindrome, and implement precise addition of non-negative decimal strings without using native floating-point types.

    Stringsstringsmath-bitshash-table
  • StringsMediumModel answer
    Debugging and Hardening a Lightweight Template Engine

    Trace three root causes in a minimal template rendering engine—regex greediness, loop parsing, and path traversal—and present targeted fixes with regression tests.

    Stringsdebuggingparsingregexsecurity
  • 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
  • StringsMediumModel answer
    Fix a Buggy Python Table-to-CSV Function

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

    Stringscode-reviewcsvpythonstring-building