Link the Combo Scores
Context
In the arcade game Neon Rally, a player’s move scores are recorded in order. The combo board links each move with the move immediately after it. For every such neighboring pair, create one combo score by adding the two scores. Linked pairs overlap: a move may contribute to the pair before it and the pair after it.
Problem
Implement a function that receives the ordered scores from a game run. Return a new array containing the sum of each score and the score immediately following it, in the same left-to-right order. Process every complete neighboring pair exactly once. If the input has zero or one score, return an empty array because no complete pair exists. Do not remove or merge repeated scores; positions determine the pairs.
Examples
scores = [10, 25, 15, 30][35, 40, 45]scores = [7, 7, 12, 7][14, 19, 19]scores = [42][]Constraints
0 <= len(scores) <= 1000 <= scores[i] <= 1000 for every i- Types:
scoresis int[]; result is int[]
Function signature
def combine_adjacent_scores(scores: list[int]) -> list[int]
scoreslist[int]- The scores of moves, listed in the order they occurred.
- returns list[int]
- An array whose elements are the sums of consecutive scores, ordered by the first score in each pair.
Adapted from MBPP problem task_206 (CC BY 4.0). Rewritten, extended and verified by Iksha.
Notes
- Pairs are based on positions, so duplicate scores remain separate occurrences.