821. Reverse an array 2

Given an array nums of n integers, return reverse of the array.

Example 1:

Input : nums = [1, 2, 3, 4, 5]

Output : [5, 4, 3, 2, 1]

Example 2:

Input : nums = [1, 3, 3, 3, 5]

Output : [5, 3, 3, 3, 1]

Now Your Turn!

Pick the correct output for the given input

Input : nums = [1, 2, 1]

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 <= n <= 100
  • 1 <= nums[i] <= 100
0
class Solution{
public:
vector<int> reverseArray(vector<int>& nums){
//your code goes here
}
};
Test Case

Input:

Nums