FastPrepFastPrep
Problem Brief

Ways to Split String

FULLTIMEOA
See Google online assessment and hiring insights

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.

1Example 1

Input
s = "aaaa"
Output
3
Explanation
We can get a - aaa, aa - aa, aaa - a.

2Example 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.

3Example 3

Input
s = "ababa"
Output
2
Explanation
We can get ab - aba, aba - ba.

Constraints

Limits and guarantees your solution can rely on.

We dont know yet. If you happen to know aout it feel free to lmk. TYSM!
public int numWaysToSplitString(String s) {
    // write your code here
}
Input

s

"aaaa"

Output

3

Sign in to submit your solution.