A lot of method in the discuss used the temporary variables, such as "int temp" and so on. My understanding is that just use the "x" to solve the problem. Is there any algorithms to do it ?
"without extra space" usually means with o(1) space. so if you use a temp variable you'e still using o(1) space and it is fine. But you should be more specific about the problem you're talking about.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.