A keypad log is a lowercase string s. An access code is any block of exactly k consecutive characters. A code is clean if none of its characters repeats. Return how many of the len(s) - k + 1 codes are clean (return 0 when k > len(s)).
Examples
Input: s = "abcabc", k = 3
Output: 4
Explanation: "abc", "bca", "cab", "abc" are all clean.
Input: s = "aab", k = 2
Output: 1
Explanation: "aa" repeats a letter; "ab" is clean.
Input: s = "ab", k = 3
Output: 0
Constraints
0 <= len(s) <= 10**5,1 <= k <= 10**5sconsists of lowercase English letters.- Target complexity: O(n) time; building a set for each block is too slow for the largest tests.
Goals
- Track how many letters are duplicated inside a fixed window
- Update that count in O(1) as one letter enters and one leaves