Trains the technique from
LeetCode 1010Pairs of Songs With Total Durations Divisible by 60This is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A playlist's track lengths, in seconds, read seconds.
Return how many pairs of different positions hold two tracks whose lengths add up to a whole number of minutes, that is to a multiple of sixty seconds. A pair counts once, whichever order it is taken in.
Example 1
The two lengths of thirty add to sixty, exactly one whole minute.
Example 2
Fifty-nine and one add to sixty. The track of a hundred and twenty already fills two whole minutes on its own, but a pair needs two tracks, and it leaves neither of the others on a whole minute.
Example 3
Five hundred leaves twenty over a whole minute, and twenty and twenty come to forty, never sixty.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def num_pairs_divisible_by60(seconds: list[int]) -> int:public int numPairsDivisibleBy60(int[] seconds)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.