Tap here to switch tabs
Problem
Submissions

Problem: Count of Interesting Subarrays

Try to solve the Count of Interesting Subarrays problem.

Statement

Given a 00 indexed integer array nums and two integers modulo and k.

A subarray from index l to r is defined as interesting if, letting cnt be the number of indices i in the range l ≤\leq i ≤\leq r such that nums[i] % modulo == k, the condition cnt % modulo == k holds true.

Return the total number of interesting subarrays.

Constraints:

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

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq modulo ≤109\leq 10^9

  • 0≤0 \leq k << modulo

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count of Interesting Subarrays

Try to solve the Count of Interesting Subarrays problem.

Statement

Given a 00 indexed integer array nums and two integers modulo and k.

A subarray from index l to r is defined as interesting if, letting cnt be the number of indices i in the range l ≤\leq i ≤\leq r such that nums[i] % modulo == k, the condition cnt % modulo == k holds true.

Return the total number of interesting subarrays.

Constraints:

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

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq modulo ≤109\leq 10^9

  • 0≤0 \leq k << modulo