Given a string, find minimum number of changes to it so that all substrings of the string become distinct.
Input : str = "aab" Output : 1 If we change one instance of 'a' to any character from 'c' to 'z', we get all distinct substrings. Input : str = "aa" Output : 1
To make all substrings distinct, every character must be different. So we simply need to count number of repeated characters. If length of string is more than 26, then we cannot convert it into a string with all distinct substrings (Here we assume that string should contain only lower case characters, ‘a’ to ‘z’)
- Find distinct characters in distinct substrings of a string
- Count of distinct substrings of a string using Suffix Trie
- Count of distinct substrings of a string using Suffix Array
- Minimum number of substrings the given string can be splitted into that satisfy the given conditions
- Minimum steps to delete a string after repeated deletion of palindrome substrings
- Minimum changes required to make first string substring of second string
- Minimum number of deletions to make a string palindrome
- Minimum number of deletions to make a string palindrome | Set 2
- Minimum number of additons to make the string balanced
- Minimum cost to make a string free of a subsequence
- Minimum characters to be added at front to make string palindrome
- Minimum operations required to make the string satisfy the given condition
- Minimum swaps required to make a binary string divisible by 2^k
- Minimum number of Appends needed to make a string palindrome
- Minimum number of swaps to make two binary string equal
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.