Tap here to switch tabs
Problem
Submissions

Problem: K Divisible Elements Subarrays

med
30 min
Try to solve the K Divisible Elements Subarrays problem.

Statement

Given an integer array nums and two integers k and p, return the number of distinct subarrays that contain at most k elements divisible by p.

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

Note: Two subarrays are considered distinct if they have different lengths or contain different elements at corresponding positions.

Constraints:

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

  • 1≤1 \leq nums[i], p ≤200\leq 200

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: K Divisible Elements Subarrays

med
30 min
Try to solve the K Divisible Elements Subarrays problem.

Statement

Given an integer array nums and two integers k and p, return the number of distinct subarrays that contain at most k elements divisible by p.

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

Note: Two subarrays are considered distinct if they have different lengths or contain different elements at corresponding positions.

Constraints:

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

  • 1≤1 \leq nums[i], p ≤200\leq 200

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