Though it says O(1) space, recursive solution got accepted


Comment body goes here.


Even swapping the data is allowed


The solution using recursion got accepted. Can someone point to this? Isn’t using space from function stack a wrong practice when the problem asks to use constant extra space only?


Yeah it was intended to be solved without using any kind of space (that includes stack space used during recursion).