Generating the power set using Bitmasking!

The function filterChars is not clear, can you please explain it once again using dry run

Hi @exceptionXD
Filter_char function gives you the nth permutation of the string given.
For Example
You have a string “abcd”, n=4
4 = 0100
mapping the binary representation of n into the string gives output - “b” since a,c,d get 0.

For n=6
6=0110
functions returns string - “bc” since a,d get 0.

I hope this helps you understand the function better.
Please mark the thread Resolved if so :slight_smile: