Finding the missing number in an array

Finding the missing number in an array containing n distinct numbers taken from 0, 1, 2, …, n is a classic problem that can be efficiently solved using bit manipulation. The idea is to use the XOR operation, which has two useful properties for this problem: Given these properties, you can XOR all the numbers … Read more