didn’t get the concept of 2^1-1 while removing range of bits
and how does it relate to (i<<i)-1.
Removing range of bits
hey @dhruvj797
question requires a mask which has first i values set as 1 so we make this mask using 2^i-1 for eg: if we require a mask 0011 we do 2^2-1 = 3 which is 0011 and,
1<<i = 2^i
that means if u left shift 1 by i times the value will be equal to 2^i;
this is a basic rule of bit manipulation.
hope this clears your doubt
happy coding
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.