1573. Number of Ways to Split a String
https://leetcode.com/problems/number-of-ways-to-split-a-string
Description
Given a binary string s
(a string consisting only of '0's and '1's), we can split s
into 3 non-empty strings s1, s2, s3 (s1+ s2+ s3 = s).
Return the number of ways s
can be split such that the number of characters '1' is the same in s1, s2, and s3.
Since the answer may be too large, return it modulo 10^9 + 7.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
3 <= s.length <= 10^5
s[i]
is'0'
or'1'
.
ac
Last updated