Subarray Sums Divisible By K

easy
1. Given an array A of integers. . 2. The task is to count the number of subarray that have a sum divisible by K. 3. Input and output is handled for you 4. It is a functional problem ,please do not modify main()

Input Format

first line contains size of array N and K. second line contains N integers of array. Input is handled for you.

Output Format

Return count of the subarray that have a sum divisible by K. Output is handled for you.

Constraints

1 <= N <= 30000
 -10000 <= A[i] <= 10000
 2 <= K <= 10000

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
6 5
4 5 0 -2 -3 1
Output
7
Previous
Subarray Range With Given Sum
Next
Subarrays With Equal 1s And 0s

Related Questions