Reverse an Array (Set 2)

Easy

Given an array of integers nums, return a new array with the same values in reverse order.

Reverse an Array (Set 2) — the data. This set runs 4 cases: nums holds arrays of 9–19 items, with values from -39 to 40. The hidden cases are the largest of the set.

Example 1

reverseArrayValues()
Input
nums = [26, -39, -24, 0, 6, 27, 7, 9, -35, -10]
Output
[-10, -35, 9, 7, 27, 6, 0, -24, -39, 26]

Why

`reverseArrayValues` returns `[-10, -35, 9, 7, 27, 6, 0, -24, -39, 26]` for this input.

Example 2

reverseArrayValues()
Input
nums = [-3, -36, -10, -6, -17, -19, 12, -20, 24, -29, -9, 25, -4]
Output
[-4, 25, -9, -29, 24, -20, 12, -19, -17, -6, -10, -36, -3]

Why

`reverseArrayValues` returns `[-4, 25, -9, -29, 24, -20, 12, -19, -17, -6, -10, -36, -3]` for this input.
Constraints
0 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

ArraysTwo Pointers

Implement reverseArrayValues in the editor and return the answer — printing it is never graded.