Solved LeetCode program · 774 of 1,000
#1010 · Pairs of Songs With Total Durations Divisible by 60
Original English source
The lengths is a list of 30, 20, 150, 100, and 40. The remainders is a list of 60 zeros. The total is 0.
For every spot from 0 to the last position of lengths.
The rest is item spot of lengths modulo 60. The partner is 0. If rest is not 0, set partner to 60 minus rest. Increase total by item partner of remainders. Increase item rest of remainders by 1.
Show total.
Expected stdout
3