Subsets using bit manipulation

Why my code is giving absurd output ?printing all subsequences of a string

Hey @coderajay03 , the logic of your code is correct just the variables used are wrong .
In the inner loop you used i which is being used in both the loops , so the changes being done in the while loop is also reflected on the outerloop so we have to use different independent variables in order for the code to woek .
Dry run the code once or twice to get a hang of what’s actually happening
Here’s the updated code :slight_smile:


Hope it helps :blush: Happy coding !!

1 Like