3 ms·
Before going to solutions, people need to be made aware of it first. Take any "introduction to programming" course, and it is likely to include a question on:
by thewisenerd 10y ago
Before going to solutions, people need to be made aware of it first.
Take any "introduction to programming" course, and it is likely to include a question on: "swap two variables without using a third variable". When basic algebra is the simplest way to solve it, you also need to point out of the obvious case of integer overflow.
When I asked my professor why I wasn't graded for using the XOR-swap for solving that question, his reply was "we do not expect students to know this".