#30

Substring with Concatenation of All Words

master · 1880 · lc hard +32 · 34.1% accepted · 2,616 likes · top 12%

play →

Description

All strings in array words have equal length. A valid starting index in s is one where the substring of appropriate total length contains each word in words exactly the required number of times (in any order). Return all such starting indices in any order.

Code

1
2
3