What is the fastest way to find all subsequences of a string?

Ex → string s = “abc”

int n = s.size();
so its subsequences will be
a,ab,abc,b,bc,c,ac,""

what is the fastest way to find all the subsequences ?

"ac" is not a substring of string “abc”.
It is a valid subsequence not a substring.

okay…sorry

then whats the fastest way to find all the subsequences ? ?

you can refer this - Print all subsequences of a string - GeeksforGeeks

2 Likes

okay thank you.