Reverse Array
Easy
Reversing an array means rearranging the elements so that the first element becomes the last,
the second element becomes the second last, and so on.
Example 1
Input
arrs = [1, 4, 3, 2, 6, 5]
Output
[5, 6, 2, 3, 4, 1]
Explanation
The first element 1 moves to last position, the second element 4 moves to second-last and so on.
Example 2
Input
arr[] = [4, 5, 1, 2]
Output
[2, 1, 5, 4]
Explanation
The first element 4 moves to last position, the second element 5 moves to second last and so on. ,write for article
Constraints
1 <= n <= 10^5
-10^9 <= arr[i] <= 10^9
Hints:
Hint 1
Start with the straightforward approach, then optimize time or space if needed.
Auto
Loading editor...
Input
Expected Output