CT005

Anagram Rune Hunt

MediumAcceptance: 0.0%

The Codetikki scribes hide anagram-runes throughout the ancient scrolls. Given a target rune-word and a long scroll string, find all starting indices in the scroll where an anagram of the rune-word begins. Given a word w and a string s, find all indices in s which are the starting locations of anagrams of w.

Example 1:

Input: ab abxaba
Output: 0 3 4

Example 2:

Input: abc cbabcacba
Output: 0 2 4 6

Constraints:

1 <= len(w) <= 10^5 1 <= len(s) <= 10^5 w and s consist of lowercase English letters

Tags:

strings hash-table sliding-window
Loading...
Test Cases:No test cases
No test cases available.