Help in dp bitmask problem

solution link - https://sites.google.com/site/olimpous88/problems/spoj-6072-chocolate
What does line mean.
for(int mask1 =((mask-1)& mask);mask1;mask1 = ((mask1-1) & mask))

Iterating over all submasks of mask
If mask is 11001
Then mask1 will be
11000
10001
10000
01001
01000
00001
00000

1 Like

Thanks.