Divisible Pair Count
Count the pairs of positions i < j for which nums[i] + nums[j] is divisible by k.
Example 1
nums [1,2,3,4,5]
k 3
returns 4
Pairs (1,2), (1,5), (2,4), (4,5) have sums 3, 6, 6, 9.
Constraints
0 <= len(nums) <= 50-100 <= nums[i] <= 1001 <= k <= 20
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.