Hard
,String
,DP
A program was supposed to print an array of integers. The program forgot to print whitespaces and the array is printed as a string of digits s
and all we know is that all integers in the array were in the range [1, k]
and there are no leading zeros in the array.
Given the string s
and the integer k
, return the number of the possible arrays that can be printed as s
using the mentioned program. Since the answer may be very large, return it modulo 109 + 7.
Example 1:
Example 2:
Example 3:
Constraints:
s.length
<= 105s
consists of only digits and does not contain leading zeros.k
<= 109