Smallest pair of integers with minimum difference whose Bitwise XOR is N | Function to find the numbers A and B whose Bitwise XOR is N and the difference between them is minimum ; Find the MSB of the N ; Find the value of B ; Find the value of A ; Print the result ; Driver Code
function findAandB ( N ) { let K = Math . log2 ( N ) ; let B = ( 1 << K ) ; let A = B ^ N ; document . write ( A + ' ' + B ) ; } let N = 26 ; findAandB ( N ) ;