← 返回 amazon 的题目列表Sum Neighbors until Two Numbers Left
类型:online_judge
Given a list of integers, repeatedly sum adjacent pairs and take the last digit (i.e., modulo 10) until only two numbers remain in the list. Return these two numbers as a concatenated string.
Example
Input: [1, 2, 3, 4]
Output: '82'
Explanation
[1, 2, 3, 4] -> [3, 5, 7]
[3, 5, 7] -> [8, 2]
Finally, output '82'.
Example
Input
[1, 2, 3, 4]