my code is printing all subsequences and no of subsequences but it is not passing all test cases.Here is my code
link-https://ide.codingblocks.com/s/221827
Recursion subsequeces
hello @17pa1a0277
your formula for number of subsequence is wrong.
it should be 2^n because we have two choices for each position (i.e add it to our subsequence or ignore it).
so for n position we have 2 * 2 * 2 * 2…n times => 2^n
my entire code is right only ,
one mistake is no of subsequences formula
yeah . . . . . . . .
1 Like