Back to problems

String Anagram Windows

Algorithm · Salesforce · Medium

You are given two strings, s and p. Return a list of all the starting indices where a substring of s is an anagram of p. The answer may be returned in any order. An anagram of a string is another string that contains the exact same characters, each with the same frequency, but possibly in a different order. Example 1: Explanation: The substrings "bacd" (index 0), "abcd" (index 5), and "bcda" (index 6) are all anagrams of "abcd". Example 2: Example 3: Constraints: 1 <=…

Checking your access…