Xor profit sum. explanation

Can u explain how the efficient way is working

read this… multiple explanations are there in the discussion form of this Q… Hopefully you will get one of them…