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


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

Solution creates another function that has extra space.

Very misleading question


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.