Back to course home
0% completed
Vote For New Content
Solution: Problem Challenge 4: Words Concatenation
Problem Statement
You’re given a string s
and a list of words words
, where all words have the same length.
A concatenated substring is formed by joining all the words from any permutation of words
— each used exactly once, without any extra characters in between.
For example, if words = ["ab", "cd", "ef"]
, then valid concatenated strings include "abcdef"
, "abefcd"
, "cdabef"
, "cdefab"
, "efabcd"
, and "efcdab"
. A string like "acdbef"
is not valid because it doesn't match any complete permutation of the given words.
Return all starting indices in `s
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page