Algorithm Problem 007: Substring with Concatenation of All Words
Problem
Problem Source: 30. Substring with Concatenation of All Words
Problem Description:
You are given a string
sand an array of stringswords. All the strings ofwordsare of the same length.A concatenated string is a string that exactly contains all the strings of any permutation of
wordsconcatenated.
- For example, if
words = ["ab","cd","ef"], then"abcdef","abefcd","cdabef","cdefab","efabcd", and"efcdab"are all concatenated strings."acdbef"is not a concatenated string because it is not the concatenation of any permutation ofwords.Return an array of the starting indices of all the concatenated substrings in
s. You can return the answer in any order.