values and two integers width and times. Check whether the array contains a block of width consecutive elements that is immediately followed, with no gaps and no overlap, by at least times - 1 more copies of the same block.
In other words, is there a stretch of length width * times made of a single block of length width written times times in a row? The block may repeat more than times times.
Return True if such a block exists and False otherwise.values=[7, 3, 8, 3, 8, 3, 8, 1], width=2, times=3 → True
The block [3, 8] appears three times in a row starting at index 1.
values=[5, 5, 2, 5, 5], width=2, times=2 → False
[5, 5] occurs twice, but the 2 between them breaks the run. No other block of length 2 works either.
values=[6, 6, 6, 6], width=1, times=4 → True
The block [6] repeats exactly four times.
values=[7, 3, 8, 3, 8, 3, 8, 1], width=2, times=3
True
Run checks the first 3 tests in your browser. Submit checks all 128 tests on the server, hidden ones included.