FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 2867,3 "name": "ways-to-split-array-into-good-subarrays",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/ways-to-split-array-into-good-subarrays/",6 "date": "2023-06-18",7 "task_description": "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** `109 + 7`. 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,1] [0,0,1] - [0,1,0] [0,1] - [0,1,0,0] [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:** `1 <= nums.length <= 105` `0 <= nums[i] <= 1`",8 "test_case": [9 {10 "label": "Example 1",11 "input": "nums = [0,1,0,0,1]",12 "output": "3 "13 },14 {15 "label": "Example 2",16 "input": "nums = [0,1,0]",17 "output": "1 "18 }19 ],20 "constraints": [21 "1 <= nums.length <= 105",22 "0 <= nums[i] <= 1"23 ],24 "python_template": "class Solution(object):\n def numberOfGoodSubarraySplits(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n ",25 "java_template": "class Solution {\n public int numberOfGoodSubarraySplits(int[] nums) {\n \n }\n}",26 "metadata": {27 "func_name": "numberOfGoodSubarraySplits"28 }29}