Tap here to switch tabs
Problem
Submissions

Problem: Number of Unique Good Subsequences

med
30 min
Try to solve the Number of Unique Good Subsequences problem.

Statement

You are given a binary string binary. A subsequence of binary is considered good if it is not empty and does not contain leading zeros, with the exception of the string "0" itself.

Return the total number of unique good subsequences of binary. Because the answer may be very large, return it modulo 109+710^9 + 7.

Note: A subsequence is a sequence that can be derived from another sequence by deleting zero or more elements without changing the order of the remaining elements.

Constraints:

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

  • binary consists only of '0' and '1'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Unique Good Subsequences

med
30 min
Try to solve the Number of Unique Good Subsequences problem.

Statement

You are given a binary string binary. A subsequence of binary is considered good if it is not empty and does not contain leading zeros, with the exception of the string "0" itself.

Return the total number of unique good subsequences of binary. Because the answer may be very large, return it modulo 109+710^9 + 7.

Note: A subsequence is a sequence that can be derived from another sequence by deleting zero or more elements without changing the order of the remaining elements.

Constraints:

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

  • binary consists only of '0' and '1'.