24. Subarray Sums Divisible by K
Given an integer array nums
and an integer k
, return the number of non-empty subarrays that have a sum divisible by k
. A subarray is a contiguous part of an array.
nums
and an integer k
, return the number of non-empty subarrays that have a sum divisible by k
. A subarray is a contiguous part of an array.
Example 1:
Example 2:
Solution: (Prefix sum with modulo)
Last updated