Generate All Subsequences of a String
Problem Generate ALL subsequences of a string — every subset of characters with original order preserved (2^n of them, including the empty one; clarify if empty should be excluded).
Input / Output
- Input: string s. Output: list of all subsequences.
Constraints
- |s| <= ~20 (output is exponential by nature); duplicates in s produce duplicate subsequences — ask whether to dedupe.
Example
- "abc" → ["", "a", "b", "c", "ab", "ac", "bc", "abc"].
asked …