Interview Question

Coop-Software Developer Interview

-Waterloo, ON


If given an infinite amount of memory, whats the fastest way to reverse an array?

AnswerAdd Tags

Interview Answers

3 Answers


Allocate an array of equal size and write the last index of original array to 0th index of 1st array .. (n-1)th to 1st index and so on

Engineer on


Use a temp variable and do swap for half of the array

Anonymous on


Split the array in half, reverse them, split the two in half, reverse them, etc. until you cannot reverse anymore.

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.