Google OA
Ways to Split String
FULLTIME
Given a string S , we can split S into 2 strings: S1 and S2. Return the number of ways S can be split such that the number of unique characters between S1 and S2 are the same.
Example 1 :
Input: s = "aaaa"
Output: 3
Explanation: We can get a - aaa, aa - aa, aaa - a.
Example 2 :
Input: s = "bac"
Output: 0
Explanation:
There are no ways to split the string such that the number of unique characters between S1 and S2 are the same.
Example 3 :
Input: s = "ababa"
Output: 2
Explanation:
We can get ab - aba, aba - ba.
