Substring with Concatenation of All Words

Hard · Arrays & Strings · about 30 minutes

Asked at Amazon, Google, Microsoft, Bloomberg, eBay, Walmart Global Tech, Wayfair, Glean, Shopee, Flipkart, Zalando.

All strings in words share one length. Gluing all of them together in some order (every word used once) gives a *concatenation*. Find every position in s where a substring that is such a concatenation starts, and return those positions in increasing order.

Related guides