Facebook | Phone | Anagram Substring Search

Anonymous User
3896
Oct 16, 2020
Oct 17, 2020

Position: E5-E6
Location: London

Implement the .indexOf() function, but allow for anagrams of letters.

"actor".anagrammedIndexOf("cat") = 0 // 'act' is an anagram of 'cat'
"actor".anagrammedIndexOf("rot") = 2 // 'tor' is an anagram of 'rot'
"actor".anagrammedIndexOf("car") = -1 // no anagram of "car" appears consecutively in "actor", even though the individual characters do appear.

Simlar to https://leetcode.com/problems/find-all-anagrams-in-a-string/

Comments (7)