Leetcode 1016 Solution
This article provides solution to leetcode question 1016 (subarray-sums-divisible-by-k)
Access this page by simply typing in "lcs 1016" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
class Solution: def subarraysDivByK(self, A: List[int], K: int) -> int: m =  * K m = 1 s = 0 for a in A: s += a m[s % K] += 1 return int(sum([v * (v - 1) / 2 for v in m]))