Subarray Sums Divisible by K

Medium

📝 Description

Count subarrays where sum is divisible by k

Input Format

First line: space-separated array Second line: k

Output Format

Count of subarrays

Constraints

1 ≤ nums.length ≤ 3 * 10^4

🔍 Sample Input

4 5 0 -2 -3 1
5
            

✅ Sample Output

7
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run