You are given a string s and an array of strings words. All strings in words have the same length. A concatenated string exactly contains every string in words in any permutation, back-to-back. Return all starting indices in s where such concatenations appear. Example 1: Input: s = "barfoothefoobarman", words = ["foo","bar"] Output: [0,9] Explanation: Index 0 -> "barfoo" = permutation of ["foo","bar"] Index 9 -> "foobar" = permutation of ["foo","bar"]
You mapped cues to the right algorithm and built an optimized solution.
Reuse this same workflow for advanced string and hash-map questions.