Solved LeetCode program · 950 of 1,000
#1316 · Distinct Echo Substrings
Original English source
Keep a shared text as empty text. Keep a shared seeds as an empty list of text. Keep a shared seen as an empty list of text. Keep a shared same of 0. Keep a shared count of 0. Place "abcabcabc" into seeds. Set text to item 0 of seeds.
To check from first (a whole number) with second (a whole number) and span (a whole number). Set same to 1.
For every offset from 0 to span minus 1.
The one is character (first plus offset) of text. The two is character (second plus offset) of text. If one is not two, set same to 0.
To collect from start (a whole number) with span (a whole number). The piece is the slice of text from start to start plus span. The known is 0. For every spot from 0 to the last position of seen, if item spot of seen matches piece, set known to 1. If known is 0, Place piece into seen, add 1 to count.
To probe from start (a whole number) with span (a whole number). Check from start with start plus span and span. If same is 1, Collect from start with span.
To survey from start (a whole number). The room is 9 minus start. The half is room divided by 2. For every span from 1 to half, Probe from start with span.
For every start from 0 to 8, Survey from start. Show count.
Expected stdout
3