why we are using mask here = if(i&(1<<j))
Why we are using mask condition
hi @atkr030, this i&(1<<j) gives 1 if jth bit of i is set (i.e. 1) else 0, so we are using bitmasking here to compute subsets ,in which for every i from 1 to (2^n-1) , we will find the set bits , if jth position is set means that the ith subset has the jth element of the array
if you don’t know about finding subsets using bitmasking then i will suggest you to try that first
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.