Reverse Array Elements
Given an array containing 'N' elements, the task is to reverse the order of all array elements and display the reversed array.
Explanation:
The elements of the given array need to be rearranged in reverse order.
Input:
The first line contains an integer N representing the size of the array.
The second line contains N space-separated integers representing the array elements.
Output:
A single line with N space-separated integers of the array in reversed order.
Example:
Input:
N = 5
array = [1, 2, 3, 4, 5]
Output:
5 4 3 2 1
Constraints:
- 1 <= N <= 10^3
- 1 <= arr[i] <= 10^9
- 1 <= K < N
Note:
You are to implement the function to reverse the array; input/output operations have already been set up for you if required.
Be the first one to answer
Add answer anonymously...
Top HCLTech Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Top HR questions asked in HCLTech Software Engineer
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