readings. Add up every two adjacent readings: readings[0] + readings[1], readings[1] + readings[2], and so on.
Return True if any of these sums shows up twice, meaning there are two adjacent pairs starting at different positions with the same sum. The pairs are allowed to overlap. Otherwise return False.readings=[3, 7, 1, 9] → True
The neighbor sums are 10, 8 and 10: the pairs (3, 7) and (1, 9) sit in different places but share a sum.
readings=[2, 4, 6, 8] → False
The sums are 6, 10 and 14, all different.
readings=[-5, 5, -5] → True
The pairs (-5, 5) and (5, -5) overlap, yet they start at different positions and both sum to 0.
readings=[3, 7, 1, 9]
True
Run checks the first 3 tests in your browser. Submit checks all 122 tests on the server, hidden ones included.