Pattern

String manipulation

A grab-bag label for problems whose real technique is scanning, comparing, or transforming text — the technique itself lives elsewhere.

What it is

"String" is a category tag, not one technique: it covers any problem where the input is text and the core work is walking, comparing, or rewriting characters. Under that umbrella you find two-pointer scans (palindrome checks), stack-based matching (balanced brackets), interval or prefix dynamic programming (palindromic substrings, edit distance), hand-written parsers (integer conversion, calculators), hash-based grouping (anagrams), and graph search over an implicit word graph (word ladders). What ties them together is the data shape, not the algorithm, so the first job on any string question is naming which of those techniques actually applies.

When it applies

Tells in the problem

The classic mistake

Picking a technique before naming what "matches" or "differs" means at the character level is the recurring error, and it surfaces three lines in, once the chosen structure can't express the rule. A common example: reaching for a plain delimiter to join strings for later splitting, forgetting the delimiter itself can appear inside the data — the fix (length-prefixing, or careful escaping) only becomes obvious once you ask "what if the separator is already in the input?" before writing any code. Another version is writing a palindrome check that allocates a cleaned copy when the interviewer explicitly wants O(1) space, having jumped to code before confirming the space constraint. Pause after reading the prompt and state, out loud, what operation you're optimizing (comparison, matching, transformation) before choosing the structure.

Questions to start with

All 18 string manipulation questions

Problem statement, examples and hints are free on every page; the worked approach, solution and tests are in the company guides.

Free starter pack

13 must-tier questions with full solutions

Sign in with an email — no purchase — and read them in the full reader.

No password, no spam. One sign-in email; you can read the pack in the full reader.