What irks me about this question is that it is almost utterly unrelated to any type of development task, save one: pipelining a repeated math equation in a long loop. And even then, I would bet the time it takes to swap two registers (or even L1 cache) using a third would far outperform the three operations needed because of the fact that they are sequential in nature (ie: they cannot be performed simultaneously by even an advanced CPU).
In nearly 30 years of diverse coding experience, I've never once encountered a situation where this solution would be useful.
You can absolutely puzzle out _a_ solution to that problem, it's not just a quiz. It's not even hard, given the context that you know that it's possible to do.
Steps, mostly driven by just basically knowing the goal and that there's not many operations that could possibly help:
"a" "b"
"a+b" "b"
"a+b" "-a"
"b" "-a"
"b" "a"
Then once you have that, you can enumerate the downsides to that, look for more efficient and less error-prone ways to proceed.
In nearly 30 years of diverse coding experience, I've never once encountered a situation where this solution would be useful.