BitMasking & Subset Listing for Absolute Beginners ...
Algorithm: Run a loop for 'i' for all numbers from 0 to 2^ (n-1). When inside this loop, run a loop for 'j' from 0 to n-1 inclusive. Inside this loop, check if the 'j'th bit is SET (equal to 1) for the number 'i'. If it is, then we include this element in our 'i'th subset. Done.
Get Price