Search
⌘K

Leetcode 30. Substring with Concatenation of All Words

Given a string s and an array of equal-length words, find all starting indices of substrings in s that are a concatenation of each word exactly once in any order. The core challenge is matching a multiset of fixed-length tokens efficiently (typically with a sliding-window and frequency map) over s.

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late January, 2025

Google

Google

Mid-level

Substring with Concatenation of All Words - You are given a string s and an array of strings words of the same length. Return all starting indices of substring(s) in s that is a concatenation of each word in words exactly once, in any order, and without any intervening characters.

Comments

Your account is free and you can post anonymously if you choose.