Distribute candies problem

here is the problem

can u xplain how did they used bitset here in this code
like they added 100000 i did get it … please explain thsi solution
here is the solution

hello @gulatigarvita08

they are using bitset just like a map.

minimum value of canditype is -100000 and becuase we cannot have negative index in bitset we are adding it to every canditype to make is >=0 .

and rest logic is just same.
ie if bit is set then do nothing otherwise increase count and set that bit

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.