You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters.
For example, given:
s: "barfoothefoobarman"
words: ["foo", "bar"]
You should return the indices: [0,9].
(order does not matter).
给定一个字符串 s,和一个由多个长度相等的单词组成的列表,查找 s 中的子字符串的所有起始索引,该子串是由单词列表中每个单词拼接而成的。
例如,给定:
s: "barfoothefoobarman"
words: ["foo", "bar"]
应该返回: [ 0,9 ]。
(顺序不考虑)。
For example, given:
s: "barfoothefoobarman"
words: ["foo", "bar"]
You should return the indices: [0,9].
(order does not matter).
给定一个字符串 s,和一个由多个长度相等的单词组成的列表,查找 s 中的子字符串的所有起始索引,该子串是由单词列表中每个单词拼接而成的。
例如,给定:
s: "barfoothefoobarman"
words: ["foo", "bar"]
应该返回: [ 0,9 ]。
(顺序不考虑)。