You are given a string s and an array of strings words. All the strings of words are of the same length.
A concatenated string is a string that exactly contains all the strings of any permutation of words concatenated.
Return an array of the starting indices of all the concatenated substrings in s. You can return the answer in any order.
s = "barfoothefoobarman", words = ["foo","bar"][0, 9]s = "wordgoodgoodgoodbestword", words = ["word","good","best","word"][]s = "barfoofoobarthefoobarman", words = ["bar","foo","the"][6, 9, 12]1 <= s.length <= 10^41 <= words.length <= 50001 <= words[i].length <= 30s and words[i] consist of lowercase English lettersExpected time complexity: O(n*m)Run your code to see results
Use Cmd+Enter to run