Domanda di colloquio di Agoda

Create a function that can reverse an array of integer

Risposta di colloquio

Anonimo

15 ott 2021

I came up with a swapping technique. Using a temp variable to store an array element that will be swapped between the first and last index of the array. Then, return the input array as a result this logic has a time complexity: O(n) and space complexity: O(1) where n is the amount array elements.