Tap here to switch tabs
Problem
Submissions

Problem: Count Subarrays With More Ones Than Zeros

Try to solve the Count Subarrays With More Ones Than Zeros problem.

Statement

Given a binary array nums, return the number of subarrays that contain strictly more 11s than 00s. Since the result may be very large, return it modulo 109+710^9 + 7.

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

Constraints:

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

  • 0≤0 \leq nums[i] ≤1\leq 1

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Subarrays With More Ones Than Zeros

Try to solve the Count Subarrays With More Ones Than Zeros problem.

Statement

Given a binary array nums, return the number of subarrays that contain strictly more 11s than 00s. Since the result may be very large, return it modulo 109+710^9 + 7.

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

Constraints:

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

  • 0≤0 \leq nums[i] ≤1\leq 1