Reverse an array

Beginner Problems Basic Recursion Easy

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

Examples:

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

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

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

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

Input : nums = [1, 2, 1]

Constraints

  • 1 <= n <= 100
  • 1 <= nums[i] <= 100

Company Tags

TCS Cognizant Accenture Infosys Capgemini Wipro IBM HCL Tech Mahindra MindTree