#28. swapEnds
swapEnds
Background
Description
Given an array of ints, swap the first and last elements in the array. Return the modified array. The array length will be at least 1.
Format
Input
Output
Samples
[1 2 3 4]
[4, 2, 3, 1]
[1 2 3]
[3, 2, 1]
[8 6 7 9 5]
[5, 6, 7, 9, 8]
Limitation
1s, 1024KiB for each test case.