At a last iOS Developer job interview I got a task that I didn't quite know how to do properly.
Task: Reverse an array of integers in place.
Inputs: arr
(the array), and n
- which is the number of elements in arr
Allocate as little memory as possible, and don't use Swift's object properties (so basically anything you access with a dot notation e.g .reverse()
, .insert(at:
etc. is not allowed)