Google Online Assessment (OA) 2021 | Split Strings
Given a string
s with length
n, how many ways can you split it into two substrings
s_2 such that the number of unique characters in
s_2 are the same?
s: A string with length
- The number of ways you can split it into two substrings that satisfy the condition.
s = "aaa"
Explanation: It can be split in two ways:
"a", "aa" and
s = "bac"
Explanation: There is no way to split this string into two substrings with equal unique elements.
0 <= n <= 10^5
- Characters in this string may consist of any alphanumeric character. The characters are case sensitive. That is, same letters with different cases count as different characters.