P18019 [GeeksforGeeks] String subsequence game5515
普及
题目描述

Given a string return all unique possible subsequences which start with vowel and end with consonant. A String is a subsequence of a given String, that is generated by deleting some character of a given string without changing its order.
NOTE: Return all the unique subsequences in lexicographically sorted order.
Example 1:
Input: S = "abc"
Output: "ab", "ac", "abc"
Explanation: "ab", "ac", "abc" are
the all possible subsequences which
start with vowel and end with consonant.
Example 2:
Input: S = "aab"
Output: "ab", "aab"
Explanation: "ab", "aab" are the all
possible subsequences which start
with vowel and end with consonant.
Your Task:
You dont need to read input or print anything. Complete the function allPossileSubsequences() which takes S as input parameter and returns all possible subsequences which start with vowel and end with consonant.
Expected Time Complexity: O(nlogn2^{n})
Expected Auxiliary Space: O(2^{n})
Constraints:
1<= |S| <=18

输入格式

见题面

输出格式

见题面

样例输入
S = "abc"
样例输出
"ab", "ac", "abc"