828. Count Unique Characters of All Substrings of a Given String
Hard
Input: s = "ABC"
Output:
10
Explanation:
All possible substrings are: "A","B","C","AB","BC" and "ABC".
Every substring is composed with only unique letters.
Sum of lengths of all substring is 1 + 1 + 1 + 2 + 2 + 3 = 10Input: s = "ABA"
Output:
8
Explanation:
The same as example 1, except countUniqueChars("ABA") = 1.Last updated