Swapping the bits if lesser significant is greater than higher significant bit and accordingly modifying the number
if ( m > n ) : NEW_LINE INDENT x = ( 1 << i 1 << j ) NEW_LINE num = num ^ x NEW_LINE DEDENT i += 1 NEW_LINE j -= 1 NEW_LINE return num NEW_LINE