Question asks for no extra space, but yet the solution provided has extra space


#1

Question asks for no space, but yet the solution has extra space…

Solution creates another function that has extra space.

Very misleading question


#2

I agree. I thought about the given solution in the first place and discarded it because it uses an integer.
The restriction should be rephrased.