Posts tagged

Strings

The Sliding Window Technique: Explained with 5 Interview Problems

A complete guide to the sliding window technique for coding interviews. Explains why windows beat recomputing every subarray from scratch, the crucial difference between fixed-size and variable-size windows, and the grow/shrink template that solves nearly every variable-window problem. Works through five interview problems with full Python solutions: Maximum Sum Subarray of Size K, Longest Substring Without Repeating Characters, Minimum Size Subarray Sum, Longest Repeating Character Replacement, and Minimum Window Substring. Covers the amortized O(n) argument, window-state bookkeeping with hash maps, and the signals that tell you a problem wants a sliding window.

Strings and String Manipulation: Mastering Text Processing in Python

Covers Python strings from the ground up: single and double quote syntax, triple-quoted multi-line strings, concatenation, and repetition. Demonstrates character access via indexing and slicing, then tours the most useful built-in methods including lower, upper, strip, replace, split, and join. Explains all three string formatting styles (f-strings, str.format(), and %-formatting) and covers escape characters. A text analyzer exercise counts characters, words, and unique words; a password generator challenge applies the random module to build strings meeting specific criteria.