public static void reverseArray(int arr[], int n) {
int i = 0, j = n-1;
while(i < j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
i++;
j--;
}
}
Here are some common array operations that you should know how to perform during an interview in your language of choice:
Insert an item
Remove an item
Update an item
Find an item
Loop over an array
Copy an array
Copy part of an array
Sort an array
Reverse an array
Swap two items
Filter an array