loading...

re: How Would You Reverse an Array In Place? VIEW POST

FULL DISCUSSION
 

This can be done with only the leftPointer. The rightPointer can be deduced from arr.length - leftPointer - 1.

Also, isn't Array.prototype.reverse() O(n)? It looks like, as per spec, they do almost the same thing:

Code of Conduct Report abuse