In the editorial after finding the msb we get result by applying left shift why do we subtract 1 from the result?
XOR Profit Problem
I am assuming that you have understood til finding msb. So lets take example of x = 8 and y = 20.
We first do x^y = 11100. So msb = 5 in this case according to the code. So maximum number you can generate has msb same as this number and can have all other digits as 0 or 1 which is 1xxxx. Also converting from binary to decimal, we start from 2^0. And result stores 2^(n) where n the number of bits after the msb including itself. So result will generate 22222 = 32 in this case, but actually it should start from power 0 -> 2^0 + 2^1 + 2^2 + 2^3 + 2^4 = 2^5 - 1. Hence we calculate 2^(n) then subtract 1 from it.
Hope it Helps.