FunctionRacerProblemsRace

Divisible Pair Count

EasyMathPython, JavaScript, TypeScript, Java, C++

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems