s
, the number of words, the length of each word, and the total length of a concatenated substring.wordCount
to track the frequency of each word in words
.slidingWindow
that takes an index left
and starts a sliding window from left
.wordsFound
to keep track of the words in the current window and an integer wordsUsed
to count the number of words used.s
using a right pointer, checking for valid substrings and updating wordsFound
and wordsUsed
accordingly.words
.