Practice Restore The Array
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
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 10^9 + 7.
Source: Restore The Array on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "1000", k = 10000
1
# Example 2
s = "1000", k = 10
0
# Example 3
s = "1317", k = 2000
8
Constraints
Related LeetCode Problems
Practice more problems similar to Restore The Array.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.