Why 1<<i we do why always 1

like in both find bit and set bit
why we always do 1<<i. why should we always take 1 there

Hey @TheSourabh
Its not mandatory to use 1 on LHS always .it depends on what u want to do.
We generally do 1<<i to go bit by bit of a number

u can do a<<i which will shift a by i bits to left and is also equivalent to a*(2^i)

Hey @TheSourabh
If u dont have any other doubt in this then please mark it as resolved :slight_smile:

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.