Tap here to switch tabs
Problem
Submissions

Problem: Subarray Sums Divisible by K

med
30 min
Try to solve the Subarray Sums Divisible by K problem.

Statement

Given an integer array nums and an integer k, return the number of non empty contiguous subarrays of nums whose sum is divisible by k.

Constraints:

  • 11 \leq nums.length 3104\leq 3 * 10^4

  • 104-10^4 \leq nums[i] 104\leq 10^4

  • 22 \leq k 104\leq 10^4

Tap here to switch tabs
Problem
Submissions

Problem: Subarray Sums Divisible by K

med
30 min
Try to solve the Subarray Sums Divisible by K problem.

Statement

Given an integer array nums and an integer k, return the number of non empty contiguous subarrays of nums whose sum is divisible by k.

Constraints:

  • 11 \leq nums.length 3104\leq 3 * 10^4

  • 104-10^4 \leq nums[i] 104\leq 10^4

  • 22 \leq k 104\leq 10^4