Find All Anagrams in a String

Given two strings s and p, return an array of all the start indices of p's anagrams in s. The order of the returned indices does not matter.

Constraints

  • 1 <= s.length, p.length <= 3 * 10^4
  • s and p consist of lowercase English letters.
Saving… · 2 lines
class Solution:
def findAnagrams(self, s: str, p: str) -> list[int]:
Console

Click Run to execute sample tests.