Search
⌘K
Get Premium
Leetcode 974. Subarray Sums Divisible by K
Count the number of contiguous subarrays whose sum is divisible by k; this reduces to counting pairs of prefix sums with the same remainder modulo k, typically done by tracking frequencies of prefix-sum remainders to get an O(n) solution.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.