Day 2 - Arrays and Strings
Arrays
Practice Questions
Reverse an Array

Reverse an Array

Description

  • Given an array, the task is to reverse the array.

Examples

> Case 1:
    Input: arr = [21, 32, 30]
    Output: [30, 32, 21]
 
> Case2:
    Input: arr = []
    Output: []

Constraints

Code

Analysis

  • Time Complexity: O(n)
  • Space Complexity: O(1)