scores lists them in seating order: scores[i] sits next to scores[i + 1], and the last player sits next to the first.
Return the largest absolute difference between the scores of two neighbours.scores=[3, 8, 6, -2] → 8
The neighbouring pairs are 3 and 8, 8 and 6, 6 and -2, and also -2 and 3 since the table is round. The biggest gap is |6 - (-2)| = 8.
scores=[10, 4, 1, 25] → 24
The last and first players sit side by side: |25 - 10| = 15, but 1 and 25 are neighbours too, with a gap of 24.
scores=[-5, -5] → 0
scores=[3, 8, 6, -2]
8
Run checks the first 3 tests in your browser. Submit checks all 119 tests on the server, hidden ones included.