Problem
Given an integer array and k, return the number of non-empty subarrays that have a sum divisible by k.
References
Difficulty
🟡 Medium
Companies
Goldman Sachs, Microsoft, PayPal
Notes
Language: Java
Same mod-map pattern as Continuous Subarray Sum but counting all occurrences. Handle negative remainders in Java with ((sum % k) + k) % k.
Problem
Given an integer array and k, return the number of non-empty subarrays that have a sum divisible by k.
References
Difficulty
🟡 Medium
Companies
Goldman Sachs, Microsoft, PayPal
Notes
Language: Java
Same mod-map pattern as Continuous Subarray Sum but counting all occurrences. Handle negative remainders in Java with ((sum % k) + k) % k.