The mental models the whole unit rests on
A string is just an array whose elements are characters — so every array technique carries over. This one sentence is the spine of both sessions: two pointers, in-place index rewriting, sliding window, and frequency counting all apply directly.
A–Z, a–z, 0–9, that is 26+26+10 = 62 possible
characters. An auxiliary array of fixed size 62 (or 26 for lowercase-only) is O(1)
space regardless of input length — not O(n). The read: when the
statement highlights the charset, the interviewer is hinting at this space
optimization.s[l]==s[r]. Odd-length centers on
one char (l=i, r=i); even-length centers between two (l=i, r=i+1). One helper handles both by passing different
starting indices.n(n+1)/2
substrings = O(n²). So brute-forcing "check every substring" is already
O(n²); layering an O(n) palindrome check on top makes it O(n³). Knowing
this counting fact is how you justify reaching for a smarter method in an interview.
Substring vs. subsequence. A substring is contiguous ("cr" in "cric"). A
subsequence is any set of characters kept in increasing index order, not
necessarily contiguous ("cic", "rc"). A single character counts as a subsequence.