Subject Archive for Interview Question

How to swap two integers without a temporary
Category: Programming October 28, 2012 Tags: , ,

This question is sometimes asked in interviews and it boils down to whether you know about and understand binary XOR. Binary XOR Binary XOR behaves in a slightly non intuitive way. Bits are compared between the two values and if they are the same the result is a 0 if they are different it is […] read on