Strings: A Study Guide
String algorithms for interviews: operations and Big-O, pattern matching with KMP and Rabin-Karp, a Python example, pitfalls, and the days that cover them.
Posts tagged
String algorithms for interviews: operations and Big-O, pattern matching with KMP and Rabin-Karp, a Python example, pitfalls, and the days that cover them.
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.
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.
For security reasons, please enter your password to continue.