Question d’entretien chez Agoda

Create a function that can reverse an array of integer

Réponse à la question d'entretien

Utilisateur anonyme

15 oct. 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.