Generate subsequence

I didn’t understand this part

Hello @jais_rashi,

Suppose you have n variable and
0: means ignored
1: means included

With n variables, you can have 2^n different combinations:
Example:

for n=1; let that variable be a.
2^1=2 i.e.
0 = “” (empty string, as a is ignored)
1 = a (a is considered)

for n=2; let those variables be a and b.
2^2=4 i.e.
00 = “”
01 = a (b is ignored)
10 = b (a is ignored)
11 = ba

for n=3; let those variables be a, b and c.
2^3=8 i.e.
000 = “”
001 = a (c and b are ignored)
010 = b (a and c are ignored)
011 = ba
100 = c
101 = ca
110 = cb
111 = cba
(abive is the binary representation of numbers from 0 to 7)

This logic is used in generate subsequence.

Hope, this would help.
Give a like if you are satisfied.

1 Like

Got it Sir, Thankyou so much

Anytime @jais_rashi,

Please, mark it as resolved.