Field note / fundamentals

publishedupdated 2026-05-04#algorithms#strings#sliding-window#two-pointers#frontend

Coding Practice: Strings, Sliding Window, and Two Pointers

Ten medium-level string and window questions focused on parsing, uniqueness, substring state, and pointer-based reasoning.

TL;DR

  • Strings and windows are common because they reward precise state tracking.
  • I practice them as parsing and UI-search problems, not just textbook substring exercises.
  • The key move is defining exactly what makes the current window valid.

Context

Frontend work constantly touches strings: search boxes, route parsing, query handling, template variables, validation, and text transforms. Sliding window helps when I need contiguous ranges without nested loops.

The Approach

Practice these 10 medium-level questions:

  1. Longest Substring Without Repeating Characters — canonical variable-window problem.
  2. Minimum Window Substring — track deficits precisely.
  3. Longest Repeating Character Replacement — balance window size with tolerated replacements.
  4. Valid Palindrome II — allow one deletion with pointer branching.
  5. Group Shifted Strings — normalize relative character offsets.
  6. Find All Anagram Start Indices — fixed-size window frequency matching.
  7. Compare Version Strings — parse segments without naive lexical compare.
  8. Decode Encoded String — nested pattern parsing like 3[a2[c]].
  9. Template Placeholder Expansion — replace tokens from a map with fallback handling.
  10. Longest Common Prefix After Sorting — comparator plus prefix scan.

Try it in the browser

Browser Practice

String practice: longest unique substring length

Implement solve(value) and return the length of the longest substring with no repeated characters.

Sample Tests
3 checks
Function name: solve
Best for JavaScript / TypeScript / JSON practice snippets.Monospace editorRuns in browser sandbox

Trade-offs

  • Sliding window is powerful, but only when the invariant is clear.
  • Pointer-based solutions are fast, but they become fragile if I do not document what each boundary means.

References