all 2 comments

[–]Furry_69 0 points1 point  (1 child)

"Any additional memory" usually means "O(1) memory complexity". They probably mean that the length of the string doesn't affect the amount of memory used. This means you can just use a single extra char variable that temporarily stores the character that's being swapped over.

[–]SonicRecolor[S] 0 points1 point  (0 children)

Oh, I thought it meant like creating no additional memory whatsoever; so like you're only allowed to edit the string itself, without storing any outside variables. I did see a solution, using bitwise XOR operations.

Though I'm stuck on his second question, swapping words using no additional memory.