Tap here to switch tabs
Problem
Submissions

Problem: Count Subarrays With Even Odd Ratio I

Try to solve the Count Subarrays With Even Odd Ratio I problem.

Statement

You are given an integer array nums and two integers a and b.

A subarray is considered valid if:

  • It contains at least 11 odd integer.

  • The ratio of the number of even integers to the number of odd integers in the subarray is at most ab\frac{a}{b}, which means that the number of even integers multiplied by b is less than or equal to the number of odd integers multiplied by a.

Return the total number of valid subarrays of nums.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

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

  • 1≤1 \leq a, b ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Subarrays With Even Odd Ratio I

Try to solve the Count Subarrays With Even Odd Ratio I problem.

Statement

You are given an integer array nums and two integers a and b.

A subarray is considered valid if:

  • It contains at least 11 odd integer.

  • The ratio of the number of even integers to the number of odd integers in the subarray is at most ab\frac{a}{b}, which means that the number of even integers multiplied by b is less than or equal to the number of odd integers multiplied by a.

Return the total number of valid subarrays of nums.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

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

  • 1≤1 \leq a, b ≤1000\leq 1000