Prompt
Determine if a word is an isogram — a word with no repeated letters. Case-insensitive, accent-insensitive. Empty string returns true. Multiple words return false.
Solution
This is the canonical uniqueness check, and the pattern generalizes to any "are all elements distinct?" question: pour the collection into a Set and compare sizes. A Set deduplicates on insertion, so new Set(str).size === str.length is true exactly when nothing repeated. That's O(n) time and O(n) space.
The naive alternative — for each character, scan the rest of the string with indexOf/includes — is O(n²). On a single word nobody notices; the interviewer notices, because it's the same mistake that turns a list-dedup into a jank source at scale.
The Unicode step is what makes this version senior: normalize('NFD') decomposes "é" into "e" + a combining accent (U+0300–U+036F), and the regex strips the combining marks. Without it, "Murciélago" fails the check because é and e compare as different code points. Lowercasing must happen too, or "Aa" passes incorrectly.
Red flag: comparing characters without normalizing first — accent-insensitive comparison via toLowerCase() alone doesn't exist; that only handles case. Also watch the order: normalize, strip marks, then lowercase and check.
Say it: "A Set gives me an O(n) uniqueness check — size versus length — and NFD normalization plus stripping combining marks is how I make it accent-insensitive before comparing."