2845. Count of Interesting Subarrays
You are given a 0-indexed integer array
nums
, an integermodulo
, and an integerk
.Your task is to find the count of subarrays that are interesting.
A subarray
nums[l..r]
is interesting if the following condition holds:
- Let
cnt
be the number of indicesi
in the range[l, r]
such thatnums[i] % modulo == k
. Then,cnt % modulo == k
.Return an integer denoting the count of interesting subarrays.
Note: A subarray is a contiguous non-empty sequence of elements within an array.
1 | class Solution { |