Array Reverse - Complete Tutorial
Last Updated :
23 Jul, 2025
Given an array arr[], the task is to reverse the array. Reversing an array means rearranging the elements such that the first element becomes the last, the second element becomes second last and so on.
Examples:
Input: arr[] = {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.
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.
[Naive Approach] Using a temporary array - O(n) Time and O(n) Space
The idea is to use a temporary array to store the reverse of the array.
- Create a temporary array of same size as the original array.
- Now, copy all elements from original array to the temporary array in reverse order.
- Finally, copy all the elements from temporary array back to the original array.
Working:
Below is the implementation of the algorithm:
C++
// C++ Program to reverse an array using temporary array
#include <iostream>
#include <vector>
using namespace std;
// function to reverse an array
void reverseArray(vector<int> &arr) {
int n = arr.size();
// Temporary array to store elements in reversed order
vector<int> temp(n);
// Copy elements from original array to temp in reverse order
for(int i = 0; i < n; i++)
temp[i] = arr[n - i - 1];
// Copy elements back to original array
for(int i = 0; i < n; i++)
arr[i] = temp[i];
}
int main() {
vector<int> arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for(int i = 0; i < arr.size(); i++)
cout << arr[i] << " ";
return 0;
}
C
// C Program to reverse an array using temporary array
#include <stdio.h>
#include <stdlib.h>
// function to reverse an array
void reverseArray(int arr[], int n) {
// Temporary array to store elements in reversed order
int temp[n];
// Copy elements from original array to temp in reverse order
for(int i = 0; i < n; i++)
temp[i] = arr[n - i - 1];
// Copy elements back to original array
for(int i = 0; i < n; i++)
arr[i] = temp[i];
}
int main() {
int arr[] = { 1, 4, 3, 2, 6, 5 };
int n = sizeof(arr) / sizeof(arr[0]);
reverseArray(arr, n);
for(int i = 0; i < n; i++)
printf("%d ", arr[i]);
return 0;
}
Java
// Java Program to reverse an array using temporary array
import java.util.Arrays;
class GfG {
// function to reverse an array
static void reverseArray(int[] arr) {
int n = arr.length;
// Temporary array to store elements in reversed order
int[] temp = new int[n];
// Copy elements from original array to temp in reverse order
for (int i = 0; i < n; i++)
temp[i] = arr[n - i - 1];
// Copy elements back to original array
for (int i = 0; i < n; i++)
arr[i] = temp[i];
}
public static void main(String[] args) {
int[] arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for (int i = 0; i < arr.length; i++)
System.out.print(arr[i] + " ");
}
}
Python
# Python Program to reverse an array using temporary array
# function to reverse an array
def reverseArray(arr):
n = len(arr)
# Temporary array to store elements in reversed order
temp = [0] * n
# Copy elements from original array to temp in reverse order
for i in range(n):
temp[i] = arr[n - i - 1]
# Copy elements back to original array
for i in range(n):
arr[i] = temp[i]
if __name__ == "__main__":
arr = [1, 4, 3, 2, 6, 5]
reverseArray(arr)
for i in range(len(arr)):
print(arr[i], end=" ")
C#
// C# Program to reverse an array using temporary array
using System;
class GfG {
// function to reverse an array
static void reverseArray(int[] arr) {
int n = arr.Length;
// Temporary array to store elements in reversed order
int[] temp = new int[n];
// Copy elements from original array to temp in reverse order
for (int i = 0; i < n; i++)
temp[i] = arr[n - i - 1];
// Copy elements back to original array
for (int i = 0; i < n; i++)
arr[i] = temp[i];
}
static void Main() {
int[] arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for (int i = 0; i < arr.Length; i++)
Console.Write(arr[i] + " ");
}
}
JavaScript
// JavaScript Program to reverse an array using temporary array
// function to reverse an array
function reverseArray(arr) {
let n = arr.length;
// Temporary array to store elements in reversed order
let temp = new Array(n);
// Copy elements from original array to temp in reverse order
for (let i = 0; i < n; i++)
temp[i] = arr[n - i - 1];
// Copy elements back to original array
for (let i = 0; i < n; i++)
arr[i] = temp[i];
}
const arr = [1, 4, 3, 2, 6, 5];
reverseArray(arr);
console.log(arr.join(" "));
Time Complexity: O(n), Copying elements to a new array is a linear operation.
Auxiliary Space: O(n), as we are using an extra array to store the reversed array.
[Expected Approach - 1] Using Two Pointers - O(n) Time and O(1) Space
The idea is to maintain two pointers: left and right, such that left points at the beginning of the array and right points to the end of the array.
While left pointer is less than the right pointer, swap the elements at these two positions. After each swap, increment the left pointer and decrement the right pointer to move towards the center of array. This will swap all the elements in the first half with their corresponding element in the second half.
Working:
Below is the implementation of the algorithm:
C++
// C++ Program to reverse an array using Two Pointers
#include <iostream>
#include <vector>
using namespace std;
// function to reverse an array
void reverseArray(vector<int> &arr) {
// Initialize left to the beginning and right to the end
int left = 0, right = arr.size() - 1;
// Iterate till left is less than right
while(left < right) {
// Swap the elements at left and right position
swap(arr[left], arr[right]);
// Increment the left pointer
left++;
// Decrement the right pointer
right--;
}
}
int main() {
vector<int> arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for(int i = 0; i < arr.size(); i++)
cout << arr[i] << " ";
return 0;
}
C
// C Program to reverse an array using Two Pointers
#include <stdio.h>
// Function to swap two numbers
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
// function to reverse an array
void reverseArray(int arr[], int n) {
// Initialize left to the beginning and right to the end
int left = 0, right = n - 1;
// Iterate till left is less than right
while (left < right) {
// Swap the elements at left and right position
swap(&arr[left], &arr[right]);
// Increment the left pointer
left++;
// Decrement the right pointer
right--;
}
}
int main() {
int arr[] = { 1, 4, 3, 2, 6, 5 };
int n = sizeof(arr) / sizeof(arr[0]);
reverseArray(arr, n);
for (int i = 0; i < n; i++)
printf("%d ", arr[i]);
return 0;
}
Java
// Java Program to reverse an array using Two Pointers
import java.util.Arrays;
class GfG {
// function to reverse an array
static void reverseArray(int[] arr) {
// Initialize left to the beginning and right to the end
int left = 0, right = arr.length - 1;
// Iterate till left is less than right
while (left < right) {
// Swap the elements at left and right position
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
// Increment the left pointer
left++;
// Decrement the right pointer
right--;
}
}
public static void main(String[] args) {
int[] arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for (int i = 0; i < arr.length; i++)
System.out.print(arr[i] + " ");
}
}
Python
# Python Program to reverse an array using Two Pointers
# function to reverse an array
def reverseArray(arr):
# Initialize left to the beginning and right to the end
left = 0
right = len(arr) - 1
# Iterate till left is less than right
while left < right:
# Swap the elements at left and right position
arr[left], arr[right] = arr[right], arr[left]
# Increment the left pointer
left += 1
# Decrement the right pointer
right -= 1
if __name__ == "__main__":
arr = [1, 4, 3, 2, 6, 5]
reverseArray(arr)
for i in range(len(arr)):
print(arr[i], end=" ")
C#
// C# Program to reverse an array using Two Pointers
using System;
class GfG {
// function to reverse an array
static void reverseArray(int[] arr) {
// Initialize left to the beginning and right to the end
int left = 0, right = arr.Length - 1;
// Iterate till left is less than right
while (left < right) {
// Swap the elements at left and right position
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
// Increment the left pointer
left++;
// Decrement the right pointer
right--;
}
}
static void Main() {
int[] arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for (int i = 0; i < arr.Length; i++)
Console.Write(arr[i] + " ");
}
}
JavaScript
// JavaScript Program to reverse an array using Two Pointers
// function to reverse an array
function reverseArray(arr) {
// Initialize left to the beginning and right to the end
let left = 0, right = arr.length - 1;
// Iterate till left is less than right
while (left < right) {
// Swap the elements at left and right position
[arr[left], arr[right]] = [arr[right], arr[left]];
// Increment the left pointer
left++;
// Decrement the right pointer
right--;
}
}
const arr = [1, 4, 3, 2, 6, 5];
reverseArray(arr);
console.log(arr.join(" "));
Time Complexity: O(n), as we are visiting each element exactly once.
Auxiliary Space: O(1)
[Expected Approach - 2] By Swapping Elements - O(n) Time and O(1) Space
The idea is to iterate over the first half of the array and swap each element with its corresponding element from the end. So, while iterating over the first half, any element at index i is swapped with the element at index (n - i - 1).
Working:
Below is the implementation of the algorithm:
C++
// C++ Program to reverse an array by swapping elements
#include <iostream>
#include <vector>
using namespace std;
// function to reverse an array
void reverseArray(vector<int> &arr) {
int n = arr.size();
// Iterate over the first half and for every index i,
// swap arr[i] with arr[n - i - 1]
for(int i = 0; i < n/2; i++) {
swap(arr[i], arr[n - i - 1]);
}
}
int main() {
vector<int> arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for(int i = 0; i < arr.size(); i++)
cout << arr[i] << " ";
return 0;
}
C
// C Program to reverse an array by swapping elements
#include <stdio.h>
// function to reverse an array
void reverseArray(int arr[], int n) {
// Iterate over the first half and for every index i,
// swap arr[i] with arr[n - i - 1]
for (int i = 0; i < n / 2; i++) {
int temp = arr[i];
arr[i] = arr[n - i - 1];
arr[n - i - 1] = temp;
}
}
int main() {
int arr[] = { 1, 4, 3, 2, 6, 5 };
int n = sizeof(arr) / sizeof(arr[0]);
reverseArray(arr, n);
for (int i = 0; i < n; i++)
printf("%d ", arr[i]);
return 0;
}
Java
// Java Program to reverse an array by swapping elements
import java.util.Arrays;
class GfG {
// function to reverse an array
static void reverseArray(int[] arr) {
int n = arr.length;
// Iterate over the first half and for every index i,
// swap arr[i] with arr[n - i - 1]
for (int i = 0; i < n / 2; i++) {
int temp = arr[i];
arr[i] = arr[n - i - 1];
arr[n - i - 1] = temp;
}
}
public static void main(String[] args) {
int[] arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for (int i = 0; i < arr.length; i++)
System.out.print(arr[i] + " ");
}
}
Python
# Python Program to reverse an array by swapping elements
def reverseArray(arr):
n = len(arr)
# Iterate over the first half and for every index i,
# swap arr[i] with arr[n - i - 1]
for i in range(n // 2):
temp = arr[i]
arr[i] = arr[n - i - 1]
arr[n - i - 1] = temp
if __name__ == "__main__":
arr = [1, 4, 3, 2, 6, 5]
reverseArray(arr)
for i in range(len(arr)):
print(arr[i], end=" ")
C#
// C# Program to reverse an array by swapping elements
using System;
class GfG {
// function to reverse an array
static void reverseArray(int[] arr) {
int n = arr.Length;
// Iterate over the first half and for every index i,
// swap arr[i] with arr[n - i - 1]
for (int i = 0; i < n / 2; i++) {
int temp = arr[i];
arr[i] = arr[n - i - 1];
arr[n - i - 1] = temp;
}
}
static void Main() {
int[] arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for (int i = 0; i < arr.Length; i++)
Console.Write(arr[i] + " ");
}
}
JavaScript
// JavaScript Program to reverse an array by swapping elements
// function to reverse an array
function reverseArray(arr) {
let n = arr.length;
// Iterate over the first half and for every index i,
// swap arr[i] with arr[n - i - 1]
for (let i = 0; i < n / 2; i++) {
let temp = arr[i];
arr[i] = arr[n - i - 1];
arr[n - i - 1] = temp;
}
}
const arr = [1, 4, 3, 2, 6, 5];
reverseArray(arr);
console.log(arr.join(" "));
Time Complexity: O(n), the loop runs through half of the array, so it's linear with respect to the array size.
Auxiliary Space: O(1), no extra space is required, therefore we are reversing the array in-place.
[Alternate Approach] Using Recursion - O(n) Time and O(n) Space
The idea is to use recursion and define a recursive function that takes a range of array elements as input and reverses it. Inside the recursive function,
- Swap the first and last element.
- Recursively call the function with the remaining subarray.
C++
// C++ Program to reverse an array using Recursion
#include <iostream>
#include <vector>
using namespace std;
// recursive function to reverse an array from l to r
void reverseArrayRec(vector<int> &arr, int l, int r) {
if(l >= r)
return;
// Swap the elements at the ends
swap(arr[l], arr[r]);
// Recur for the remaining array
reverseArrayRec(arr, l + 1, r - 1);
}
// function to reverse an array
void reverseArray(vector<int> &arr) {
int n = arr.size();
reverseArrayRec(arr, 0, n - 1);
}
int main() {
vector<int> arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for(int i = 0; i < arr.size(); i++)
cout << arr[i] << " ";
return 0;
}
C
// C Program to reverse an array using Recursion
#include <stdio.h>
// recursive function to reverse an array from l to r
void reverseArrayRec(int arr[], int l, int r) {
if(l >= r)
return;
// Swap the elements at the ends
int temp = arr[l];
arr[l] = arr[r];
arr[r] = temp;
// Recur for the remaining array
reverseArrayRec(arr, l + 1, r - 1);
}
// function to reverse an array
void reverseArray(int arr[], int n) {
reverseArrayRec(arr, 0, n - 1);
}
int main() {
int arr[] = { 1, 4, 3, 2, 6, 5 };
int n = sizeof(arr) / sizeof(arr[0]);
reverseArray(arr, n);
for(int i = 0; i < n; i++)
printf("%d ", arr[i]);
return 0;
}
Java
// Java Program to reverse an array using Recursion
import java.util.Arrays;
class GfG {
// recursive function to reverse an array from l to r
static void reverseArrayRec(int[] arr, int l, int r) {
if (l >= r)
return;
// Swap the elements at the ends
int temp = arr[l];
arr[l] = arr[r];
arr[r] = temp;
// Recur for the remaining array
reverseArrayRec(arr, l + 1, r - 1);
}
// function to reverse an array
static void reverseArray(int[] arr) {
int n = arr.length;
reverseArrayRec(arr, 0, n - 1);
}
public static void main(String[] args) {
int[] arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for (int i = 0; i < arr.length; i++)
System.out.print(arr[i] + " ");
}
}
Python
# Python Program to reverse an array using Recursion
# recursive function to reverse an array from l to r
def reverseArrayRec(arr, l, r):
if l >= r:
return
# Swap the elements at the ends
arr[l], arr[r] = arr[r], arr[l]
# Recur for the remaining array
reverseArrayRec(arr, l + 1, r - 1)
# function to reverse an array
def reverseArray(arr):
n = len(arr)
reverseArrayRec(arr, 0, n - 1)
if __name__ == "__main__":
arr = [1, 4, 3, 2, 6, 5]
reverseArray(arr)
for i in range(len(arr)):
print(arr[i], end=" ")
C#
// C# Program to reverse an array using Recursion
using System;
class GfG {
// recursive function to reverse an array from l to r
static void reverseArrayRec(int[] arr, int l, int r) {
if (l >= r)
return;
// Swap the elements at the ends
int temp = arr[l];
arr[l] = arr[r];
arr[r] = temp;
// Recur for the remaining array
reverseArrayRec(arr, l + 1, r - 1);
}
// function to reverse an array
static void reverseArray(int[] arr) {
int n = arr.Length;
reverseArrayRec(arr, 0, n - 1);
}
static void Main(string[] args) {
int[] arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for (int i = 0; i < arr.Length; i++)
Console.Write(arr[i] + " ");
}
}
JavaScript
// JavaScript Program to reverse an array using Recursion
// recursive function to reverse an array from l to r
function reverseArrayRec(arr, l, r) {
if (l >= r)
return;
// Swap the elements at the ends
[arr[l], arr[r]] = [arr[r], arr[l]];
// Recur for the remaining array
reverseArrayRec(arr, l + 1, r - 1);
}
// function to reverse an array
function reverseArray(arr) {
let n = arr.length;
reverseArrayRec(arr, 0, n - 1);
}
let arr = [1, 4, 3, 2, 6, 5];
reverseArray(arr);
console.log(arr.join(" "));
Time Complexity: O(n), the recurrence relation will be T(n) = T(n - 2) + O(1), which can be simplified to O(n).
Auxiliary Space: O(n), as we are using recursion stack.
Using Inbuilt Methods - O(n) Time and O(1) Space
The idea is to use inbuilt reverse methods available across different languages.
C++
// C++ Program to reverse an array using inbuilt methods
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// function to reverse an array
void reverseArray(vector<int> &arr) {
reverse(arr.begin(), arr.end());
}
int main() {
vector<int> arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for(int i = 0; i < arr.size(); i++)
cout << arr[i] << " ";
return 0;
}
Java
// Java Program to reverse an array using inbuilt methods
import java.util.*;
class GfG {
// function to reverse an array
static void reverseArray(List<Integer> arr) {
Collections.reverse(arr);
}
public static void main(String[] args) {
List<Integer> arr =
new ArrayList<>(Arrays.asList(1, 4, 3, 2, 6, 5));
reverseArray(arr);
for (int i = 0; i < arr.size(); i++)
System.out.print(arr.get(i) + " ");
}
}
Python
# Python Program to reverse an array using inbuilt methods
# function to reverse an array
def reverse_array(arr):
arr.reverse()
if __name__ == "__main__":
arr = [1, 4, 3, 2, 6, 5]
reverse_array(arr)
print(" ".join(map(str, arr)))
C#
// C# Program to reverse an array using inbuilt methods
using System;
class GfG {
// function to reverse an array
static void reverseArray(int[] arr) {
Array.Reverse(arr);
}
static void Main() {
int[] arr = { 1, 4, 3, 2, 6, 5 };
reverseArray(arr);
for (int i = 0; i < arr.Length; i++)
Console.Write(arr[i] + " ");
}
}
JavaScript
// JavaScript Program to reverse an array using inbuilt methods
// function to reverse an array
function reverseArray(arr) {
arr.reverse();
}
const arr = [1, 4, 3, 2, 6, 5];
reverseArray(arr);
console.log(arr.join(" "));
Time Complexity: O(n), the reverse method has linear time complexity.
Auxiliary Space: O(1) Additional space is not used to store the reversed array, as the in-built array method swaps the values in-place.
Similar Reads
Basics & Prerequisites
Data Structures
Getting Started with Array Data StructureArray is a collection of items of the same variable type that are stored at contiguous memory locations. It is one of the most popular and simple data structures used in programming. Basic terminologies of ArrayArray Index: In an array, elements are identified by their indexes. Array index starts fr
14 min read
String in Data StructureA string is a sequence of characters. The following facts make string an interesting data structure.Small set of elements. Unlike normal array, strings typically have smaller set of items. For example, lowercase English alphabet has only 26 characters. ASCII has only 256 characters.Strings are immut
2 min read
Hashing in Data StructureHashing is a technique used in data structures that efficiently stores and retrieves data in a way that allows for quick access. Hashing involves mapping data to a specific index in a hash table (an array of items) using a hash function. It enables fast retrieval of information based on its key. The
2 min read
Linked List Data StructureA linked list is a fundamental data structure in computer science. It mainly allows efficient insertion and deletion operations compared to arrays. Like arrays, it is also used to implement other data structures like stack, queue and deque. Hereâs the comparison of Linked List vs Arrays Linked List:
2 min read
Stack Data StructureA Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). LIFO implies that the element that is inserted last, comes out first and FILO implies that the element that is inserted first
2 min read
Queue Data StructureA Queue Data Structure is a fundamental concept in computer science used for storing and managing data in a specific order. It follows the principle of "First in, First out" (FIFO), where the first element added to the queue is the first one to be removed. It is used as a buffer in computer systems
2 min read
Tree Data StructureTree Data Structure is a non-linear data structure in which a collection of elements known as nodes are connected to each other via edges such that there exists exactly one path between any two nodes. Types of TreeBinary Tree : Every node has at most two childrenTernary Tree : Every node has at most
4 min read
Graph Data StructureGraph Data Structure is a collection of nodes connected by edges. It's used to represent relationships between different entities. If you are looking for topic-wise list of problems on different topics like DFS, BFS, Topological Sort, Shortest Path, etc., please refer to Graph Algorithms. Basics of
3 min read
Trie Data StructureThe Trie data structure is a tree-like structure used for storing a dynamic set of strings. It allows for efficient retrieval and storage of keys, making it highly effective in handling large datasets. Trie supports operations such as insertion, search, deletion of keys, and prefix searches. In this
15+ min read
Algorithms
Searching AlgorithmsSearching algorithms are essential tools in computer science used to locate specific items within a collection of data. In this tutorial, we are mainly going to focus upon searching in an array. When we search an item in an array, there are two most common algorithms used based on the type of input
2 min read
Sorting AlgorithmsA Sorting Algorithm is used to rearrange a given array or list of elements in an order. For example, a given array [10, 20, 5, 2] becomes [2, 5, 10, 20] after sorting in increasing order and becomes [20, 10, 5, 2] after sorting in decreasing order. There exist different sorting algorithms for differ
3 min read
Introduction to RecursionThe process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive function. A recursive algorithm takes one step toward solution and then recursively call itself to further move. The algorithm stops once we reach the solution
14 min read
Greedy AlgorithmsGreedy algorithms are a class of algorithms that make locally optimal choices at each step with the hope of finding a global optimum solution. At every step of the algorithm, we make a choice that looks the best at the moment. To make the choice, we sometimes sort the array so that we can always get
3 min read
Graph AlgorithmsGraph is a non-linear data structure like tree data structure. The limitation of tree is, it can only represent hierarchical data. For situations where nodes or vertices are randomly connected with each other other, we use Graph. Example situations where we use graph data structure are, a social net
3 min read
Dynamic Programming or DPDynamic Programming is an algorithmic technique with the following properties.It is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for the same inputs, we can optimize it using Dynamic Programming. The idea is to simply store the results of
3 min read
Bitwise AlgorithmsBitwise algorithms in Data Structures and Algorithms (DSA) involve manipulating individual bits of binary representations of numbers to perform operations efficiently. These algorithms utilize bitwise operators like AND, OR, XOR, NOT, Left Shift, and Right Shift.BasicsIntroduction to Bitwise Algorit
4 min read
Advanced
Segment TreeSegment Tree is a data structure that allows efficient querying and updating of intervals or segments of an array. It is particularly useful for problems involving range queries, such as finding the sum, minimum, maximum, or any other operation over a specific range of elements in an array. The tree
3 min read
Pattern SearchingPattern searching algorithms are essential tools in computer science and data processing. These algorithms are designed to efficiently find a particular pattern within a larger set of data. Patten SearchingImportant Pattern Searching Algorithms:Naive String Matching : A Simple Algorithm that works i
2 min read
GeometryGeometry is a branch of mathematics that studies the properties, measurements, and relationships of points, lines, angles, surfaces, and solids. From basic lines and angles to complex structures, it helps us understand the world around us.Geometry for Students and BeginnersThis section covers key br
2 min read
Interview Preparation
Practice Problem