My prof said there is an easy way to solve these as there is a trick to it. Does anyone know what trick is being referred to?
The "tricks" here are just the basic properties of bitwise arithmetic, namely that ~~x is equivalent to x (negating a bit, and then negating it again, gives you back the original bit) and x ^ x is equivalent to 0 (look at the truth table for exclusive-or). Finally, ^ is commutative. Does that make it easier?