Find the one missing number in range | Find the missing number in a range ; here we xor of all the number ; xor last number ; Driver code
function missingNum ( arr , n ) { let minvalue = Math . min ( ... arr ) ; let xornum = 0 ; for ( let i = 0 ; i < n ; i ++ ) { xornum ^= ( minvalue ) ^ arr [ i ] ; minvalue ++ ; } return xornum ^ minvalue ; } let arr = [ 13 , 12 , 11 , 15 ] ; let n = arr . length ; document . write ( missingNum ( arr , n ) ) ;