Copy and Reverse the Array
Given an array of non-negative integers ARR
, your task is to create another array COPY_ARR
with the elements of ARR
in reverse order.
Input:
The first line contains an integer T
denoting the number of test cases.
Each test case consists of a line with an integer N
indicating the number of elements in ARR
,
followed by a line with N
space-separated integers representing the elements of ARR
.
Output:
For each test case, output N
space-separated integers representing the elements of COPY_ARR
, the reversed version of ARR
.
Example:
Input:
ARR = [1, 2, 3, 4, 5]Output:
[5, 4, 3, 2, 1]
Constraints:
1 ≤ T ≤ 10^2
1 ≤ N ≤ 10^4
0 ≤ ARR[i] ≤ 10^9
Note:
Do not print anything. Implement the function to achieve the desired output.
Be the first one to answer
Add answer anonymously...
Top UnitedHealth Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
>
UnitedHealth Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
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