Tap here to switch tabs
Problem
Submissions

Problem: Number of Good Ways to Split a String

med
30 min
Try to solve the Number of Good Ways to Split a String problem.

Statement

Given a string s, find the number of good splits of the string.

A split is considered good if s is divided into two nonempty substrings p and q such that their concatenation forms s, and the number of distinct characters in p equals the number of distinct characters in q.

Return the total number of good splits of s.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Good Ways to Split a String

med
30 min
Try to solve the Number of Good Ways to Split a String problem.

Statement

Given a string s, find the number of good splits of the string.

A split is considered good if s is divided into two nonempty substrings p and q such that their concatenation forms s, and the number of distinct characters in p equals the number of distinct characters in q.

Return the total number of good splits of s.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of only lowercase English letters.