program code for this question: Raju has a lot of strings but he does not like all of them.He likes only Swaggy strings. Now Raju wants to find the Swaggy String S from the given string N. A Swaggy string S has the following properties- It must be lexicographically largest. It must be a subsequence of original string N. Every character in S must appear at least K times.
Answers
Answered by
0
Since N is the original string and S is the substring. S=kch(z) where ch(z) is the character and value of z varies from 1 to 26. The swaggy string S (kch(z) is a substring of the original string N.
The programmer can use the algorithm to find out a substring from an orginal string in order to get the swaggy string S (kch(z)).
Similar questions