Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 391 Bytes

06-ReverseArrayInPlace.md

File metadata and controls

14 lines (10 loc) · 391 Bytes

Reverse array in place

The problem

Write a function f(N) that accepts an array and returns that array reversed

  • do not use array.reverse()
  • do not create new array variable

Concepts

  • using a temporary placeholder variable
  • array traversal

Note

  • note that you should only traverse half ot the array: ; i < arr.length / 2 because by that time all elements are switched.