Solved LeetCode program · 30 of 1,000
#0030 · Substring with Concatenation of All Words
Original English source
Keep a shared text as empty text. Place "barfoothefoobarman" into text. Keep a shared words holding "foo" and "bar". Keep a shared word length as 0. Set word length to 3. Keep a shared word count as 0. Set word count to 2. Keep a shared used as an empty list of whole numbers. Keep a shared match of 0.
To verify from start (a whole number) at part (a whole number). If match is 1, return. If part is word count, set match to 1, return.
For every index from 0 to word count minus 1.
The offset is start plus part times word length. The piece is the slice of text from offset to offset plus word length. If used contains index, skip to the next one. If piece matches item index of words, Place index into used, verify from start at part plus 1, remove the last item from used, if match is 1, return.
For every start from 0 to 12.
Set match to 0. Verify from start at 0. If match is 1, show start.
Expected stdout
0 9