Reverse an Array (Set 1)

Easy

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

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

Example 1

reverseArrayValues()
Input
nums = [-36, 6, -5, 35, 0]
Output
[0, 35, -5, 6, -36]

Why

`reverseArrayValues` returns `[0, 35, -5, 6, -36]` for this input.

Example 2

reverseArrayValues()
Input
nums = [5, 3, -33, 6, -40, -16, -3]
Output
[-3, -16, -40, 6, -33, 3, 5]

Why

`reverseArrayValues` returns `[-3, -16, -40, 6, -33, 3, 5]` 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.