Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Separate Numbers

Number of Ways to Separate Numbers asks you to split a digit string into positive integers with no leading zeros and nondecreasing values, returning the count modulo a large prime.

Statement

Given a string of numerical digits num, determine the number of possible lists of positive integers that can be formed by splitting num such that the following conditions are met:

  1. No integer in the sequence contains leading zeros.

  2. The integers appear in nondecreasing order, meaning each integer is greater than or equal to the integer before it.

Since the total count may be very large, return the result modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq num.length ≤3500\leq 3500

  • num consists of digits from ′0′'0' through ′9′'9'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Separate Numbers

Number of Ways to Separate Numbers asks you to split a digit string into positive integers with no leading zeros and nondecreasing values, returning the count modulo a large prime.

Statement

Given a string of numerical digits num, determine the number of possible lists of positive integers that can be formed by splitting num such that the following conditions are met:

  1. No integer in the sequence contains leading zeros.

  2. The integers appear in nondecreasing order, meaning each integer is greater than or equal to the integer before it.

Since the total count may be very large, return the result modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq num.length ≤3500\leq 3500

  • num consists of digits from ′0′'0' through ′9′'9'.