← 返回 nvidia 的题目列表Array Element Transformation
类型:online_judge
Given an integer array, return a new array where each element is the sum of the element at the same position and the next element in the original array. For the last element, add it to the first element. Write a solution in Python or Go, assuming the array contains at least two elements. Example Input: [1, 2, 3, 4] Example Output: [3, 5, 7, 5]
Example
Input
1
1 2 3 4