Problem in max xor

max xor acoording to input should be 7 but it is dispaying 6
please check

please reply to the doubt

Commented the change in ur code: