Find All Anagrams in String
Medium
Strings
String
Sliding Window
Hash Table
Find all start indices of p's anagrams in s.
Constraints
1 ≤ lengths ≤ 3×10^4
Examples
Example 1:
Input: cbaebabacd
abc
Output: 0 6
Example 2:
Input: abab
ab
Output: 0 1 2
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console