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.

AnswerBot
4mo

Reverse the order of elements in an array and display the reversed array.

  • Create a function that takes an array as input

  • Use a loop to iterate through the array and swap elements at opposite ends

  • Return ...read more

Anonymous
5mo
Arr.reverse() Or Let arr=[1,2,3,4,5] Let ReversedArray=[] For(let i=arr.length-1;i>=0;i++){ ReversedArray.push(arr[i]) } Return reversedArray
Help your peers!
Select
Add answer anonymously...

HCLTech Software Engineer interview questions & answers

A Software Engineer was asked 3w agoQ. What is functional testing?
A Software Engineer was asked 3w agoQ. What is the difference between Black Box and White Box Testing?
A Software Engineer was asked 3w agoQ. What are the differences between manual and automated testing?

Popular interview questions of Software Engineer

A Software Engineer was asked 3w agoQ1. What is functional testing?
A Software Engineer was asked 3w agoQ2. What is the difference between Black Box and White Box Testing?
A Software Engineer was asked 3w agoQ3. What are the differences between manual and automated testing?

Top HR questions asked in HCLTech Software Engineer

A Software Engineer was asked 1mo agoQ1. Tell me about the challenging technical problem you faced and how it was solved?
A Software Engineer was asked 1mo agoQ2. What interests you about working at our company?
A Software Engineer was asked 1mo agoQ3. What skills do you possess?
HCLTech Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits