ExamAdda Logo

Reverse Array

Easy

Reversing an array means rearranging the elements so that the first element becomes the last, 

the second element becomes the second last, and so on.


 

Example 1

Input

arrs = [1, 4, 3, 2, 6, 5]

Output

[5, 6, 2, 3, 4, 1]

Explanation

The first element 1 moves to last position, the second element 4 moves to second-last and so on.

Example 2

Input

arr[] = [4, 5, 1, 2]

Output

[2, 1, 5, 4]

Explanation

The first element 4 moves to last position, the second element 5 moves to second last and so on. ,write for article

Constraints

1 <= n <= 10^5
-10^9 <= arr[i] <= 10^9

Hints:

Hint 1
Start with the straightforward approach, then optimize time or space if needed.

Author & Technical Reviewer

ExamAdda Technical Review Team

Technically reviewed by: ExamAdda Technical Review Team

Technical Reviewers, ExamAdda

Software engineers at ExamAdda who check every article's definitions, complexity claims and code examples before and after publishing.

Published

Jun 29, 2026

Last updated

Aug 6, 2026

Content Verification Methodology

Definitions and complexity claims were checked against authoritative computer-science references. Code examples were compiled and tested with standard, boundary and edge-case inputs.

Report a correction:editorial@examadda.org
Auto
Loading editor...
Input

Expected Output