Number of Unique Character Substrings
Given a lowercase alphabet string s
, return the total number of substrings that contain one unique character.
Constraints
n ≤ 10,000
wheren
is the length ofs
.
https://binarysearch.com/problems/Number-of-Unique-Character-Substrings
Examples
Example 1
Input
- s =
aab
Output
- answer =
4
Explanation
These substrings have one unique character: ["a", "a", "aa", "b"]
Leave a comment