It looks like the elements are just upside down. You can do this without additional arrays, with any swap implementation that you want to use:
int b = 0, e = array.length-1; while (b < e) { array.swap(b, e); b = b + 1; e = e - 1; }
For integers, you can use the unchanged storage "by calculating the sum and subtracting it with XORing, etc. However, never do this in production. A useless interview trick invented at a time when hardware engineers doubled the programmers more often than now (I saw this problem formulated in terms of hardware logic gates about 25 years ago).
source share