🎁 Exclusive Offer! Join our
Telegram Channel
to get **special discounts** and updates! 🚀
Question 54 - 100% Working Solution | Buy Now
Description
11 Live
Given a string, how many different substrings exist in it that have no repeating characters? Two substrings are considered different if they have a different start or end index.
Example
s = "abac"
The substrings that have no repeating characters in them are "a", "b", "a", "c", "ab", "ba", "ac", and "bac". Note that "aba" and "abac" do not qualify because the character 'a' is repeated in them. Also, note that two substrings, "a" and "a", both qualify because their start indices are different: s[0] and s[2]. There are 8 substrings that have no repeating characters.
Function Description
Complete the function findSubstrings in the editor below.
findSubstrings has the following parameter:
string s: the given string
Returns
int: the number of substrings in s that have no repeating characters
Constraints
1 ≤ length of s ≤ 10⁵
s consists of only lowercase English letters, ascii['a'-'z'].
Input Format For Custom Testing
Sample Case 0
Sample Input For Custom Testing
bcada