Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    2750 - Ways to Split Array Into Good Subarrays\.

    Medium

    You are given a binary array nums.

    A subarray of an array is good if it contains exactly one element with the value 1.

    Return an integer denoting the number of ways to split the array nums into good subarrays. As the number may be too large, return it modulo <code>10<sup>9</sup> + 7</code>.

    A subarray is a contiguous non-empty sequence of elements within an array.

    Example 1:

    Input: nums = 0,1,0,0,1

    Output: 3

    Explanation: There are 3 ways to split nums into good subarrays:

    • 0,0,1

    • 0,1

    • 1

    Example 2:

    Input: nums = 0,1,0

    Output: 1

    Explanation: There is 1 way to split nums into good subarrays: - 0,1,0

    Constraints:

    • <code>1 <= nums.length <= 10<sup>5</sup></code>

    • 0 &lt;= nums[i] &lt;= 1

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Integer numberOfGoodSubarraySplits(IntArray nums)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait