Copy and Reverse the array

You are given an array 'ARR' consisting of 'N' non-negative integers, your task is to copy the elements of 'ARR' into another array 'COPY_ARR' in reverse order.

For example:

If 'ARR' contains the following elements [ 1, 2, 3, 4, 5 ], then you should return another array that is equal to [ 5, 4, 3, 2, 1].
Input Format :
The first line of the input contains a single integer T, denoting the number of test cases.

The first line of each test case contains a single integer N, denoting the length of the array 'ARR'.

The second line of each test case contains N space-separated integers, denoting the elements of the array.
Output Format :
For each test case print, N space-separated integers, where the ith integer denotes the ith element of the array 'COPY_ARR'.
Note:
You do not need to print anything. It has already been taken care of. Just implement the given function.
Constraints :
1 <= T <= 10^2
1 <= N <= 10^4
0 <= ARR[i] <= 10^9

Time Limit: 1 sec
Be the first one to answer
Add answer anonymously...
UnitedHealth Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter