cards. On each move the player takes the first two cards of the row, and the move scores the sum of their numbers.
Play continues while at least two cards remain and every move scores exactly as much as the first move. As soon as the next move would score a different sum, the game ends.
Return how many moves can be made.cards=[6, 2, 5, 3, 1, 7, 4] → 3
Take 6 and 2 (sum 8), then 5 and 3 (8), then 1 and 7 (8). One card is left, so there are 3 moves.
cards=[4, 4, 3, 6, 4, 4] → 1
The first move scores 8, the second would score 9, so the game stops there, even though the last pair would make 8 again.
cards=[9, 1] → 1
cards=[6, 2, 5, 3, 1, 7, 4]
3
Run checks the first 3 tests in your browser. Submit checks all 106 tests on the server, hidden ones included.