Space complexity of reverse function

how does it use O(N) extra space