Search
⌘K

Leetcode 1010. Pairs of Songs With Total Durations Divisible by 60

Given an array of song durations, count pairs (i < j) whose sum is divisible by 60; this is solved efficiently by grouping durations by remainder mod 60 and pairing each remainder with its complement (with special handling for remainders 0 and 30) to compute the total pairs in linear time.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.