Find anagram indices
Given two strings s and p of lowercase English letters, return a list of the start indices of all of p's anagrams in s, in increasing order. 1 <= len(s), len(p) <= 3*10^4.
Implement
find_all_anagrams_indices(s: str, p: str) → list[int]Examples
in
["cbaebabacd","abc"]out[0,6]What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 20 min
solution.py
InputExpectedGot
["cbaebabacd","abc"][0,6]not run yetsample