digits.
You know that every number in the list was between 1 and limit inclusive and was written without leading zeros.
How many different lists could have produced the string digits? The answer may be large, so return it modulo 10⁹ + 7.digits="2105", limit=30 → 1
A zero can neither be a number on its own nor start one, so it must follow the 1: [2, 10, 5]. That is the only option.
digits="1111", limit=11 → 5
The splits are [1, 1, 1, 1], [11, 1, 1], [1, 11, 1], [1, 1, 11] and [11, 11], five in total.
digits="700", limit=99 → 0
A zero can neither stand alone nor start a number, and 700 exceeds 99, so there is no valid split.
digits="2105", limit=30
1
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.