LeetCode 30. Substring with Concatenation of All Words
Two Pointer
Input: s = "barfoothefoobarman", words = ["foo","bar"]
Output: [0,9]
Explanation: Substrings starting at index 0 and 9 are "barfoo" and "foobar" respectively.
The output order does not matter, returning [9,0] is fine too.Input: s = "wordgoodgoodgoodbestword", words = ["word","good","best","word"]
Output: []Input: s = "barfoofoobarthefoobarman", words = ["bar","foo","the"]
Output: [6,9,12]Solution
Last updated