Your program should take an array as input.
The array:
- Will always be 1 dimensional
- Will only contain integers
- Can be empty
The program should reverse the array, and then add up the elements to the original for example:
Input: [1, 2, 3]
Original: [1, 2, 3]
Reversed: [3, 2, 1]
[1, 2, 3]
+ + +
[3, 2, 1]
[1+3, 2+2, 3+1]
Output: [4, 4, 4]
Test Cases:
#In #Out
[8, 92], [100, 100]
[1, 2, 3], [4, 4, 4]
[5, 24, 85, 6], [11, 109, 109, 11]
[], []
[999], [1998]
This is code-golf, the shortest code (in bytes) wins!