Alternate method to create mask for the right index

If we use an alternate way of finding the mask for the right bit like ~( -1 << i ) instead of using (1<<i) - 1 as Prateek bhaiya showed in the video.
Would that consume more time as because we are actually performing two operations, firstly shifting the bits then performing the NOT operation ?

hello @souptiksarkar4572
there will be very minute difference between them feel free to use any of them .

1 Like

Thank you very much for resolving my query.

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.