Tap here to switch tabs
Problem
Submissions

Problem: Restore The Array

med
30 min
Try to solve the Restore The Array problem.

Statement

A program concatenated all positive integers of an array into a single string s with no separators.

Every integer in the original array met the following conditions:

  • The value was between 11 and k inclusive.

  • The value did not contain any leading zeros.

Given the string s and the integer k, return the total number of valid arrays that could have formed s. Since the answer may be large, return it modulo 109+710^9 + 7.

Constraints:

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

  • s consists of only digits and does not contain leading zeros.

  • 1≤1 \leq k ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Restore The Array

med
30 min
Try to solve the Restore The Array problem.

Statement

A program concatenated all positive integers of an array into a single string s with no separators.

Every integer in the original array met the following conditions:

  • The value was between 11 and k inclusive.

  • The value did not contain any leading zeros.

Given the string s and the integer k, return the total number of valid arrays that could have formed s. Since the answer may be large, return it modulo 109+710^9 + 7.

Constraints:

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

  • s consists of only digits and does not contain leading zeros.

  • 1≤1 \leq k ≤109\leq 10^9