Given a string s, the task is to find the number of possible non-empty sequences of letters that can be made.
Input: "AAB" Output: 8 Explanation: 1) A 2) AA 3) AAB 4) AB 5) ABA 6) B 7) BA 8) BAA Total 8 possibilities Input: "AAABBC" Output: 188
There are two possibilities either take the current character to our answer or leave it. We can solve this problem
To check for duplicates we can take set as a data Structure and will put our answers there and our count will be the size of our set.
Below is the implementation of the above approach:
- Count of sub-sequences which satisfy the given condition
- Count all sub-sequences having product <= K - Recursive approach
- Check if two same sub-sequences exist in a string or not
- Number of sub-sequences of non-zero length of a binary string divisible by 3
- Find if it is possible to make a binary string which contanins given number of "0", "1" , "01" and "10" as sub sequences
- Count pairs of parentheses sequences such that parentheses are balanced
- Find the count of palindromic sub-string of a string in its sorted form
- Count of times second string can be formed from the characters of first string
- Count subsequences in first string which are anagrams of the second string
- Count occurrences of a string that can be constructed from another given string
- Count words in a given string
- Count of 'GFG' Subsequences in the given string
- Count the pairs of vowels in the given string
- Count subsequence of length three in a given string
- Count palindromic characteristics of a String
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : mohit kumar 29