values and a positive integer divisor.
Check whether the array contains a contiguous stretch of **at least two** elements whose sum is divisible by divisor. Zero counts as divisible by anything. Return True if such a stretch exists and False otherwise.values=[5, 3, 8, 1], divisor=4 → True
The stretch [5, 3] sums to 8, which is divisible by 4.
values=[7, 7], divisor=5 → False
The only candidate is the whole array with sum 14, which is not divisible by 5. A single number does not count.
values=[4, 0, 0], divisor=9 → True
The two zeros in a row sum to 0, and 0 is divisible by anything.
values=[5, 3, 8, 1], divisor=4
True
Run checks the first 3 tests in your browser. Submit checks all 118 tests on the server, hidden ones included.