shifts holds the lengths of work shifts in hours. A dispatcher wants to join two different shifts so that together they cover a whole number of days: 24 hours, 48, 72, and so on.
Return the number of index pairs i < j for which shifts[i] + shifts[j] is a multiple of 24.shifts=[10, 14, 30, 18, 48] → 2
The pairs 10 + 14 = 24 and 30 + 18 = 48 work. 48 has no partner: its sum with any other shift is not a multiple of 24.
shifts=[24, 48, 72] → 3
Every shift is a whole number of days, so all three pairs work.
shifts=[5] → 0
With a single shift there are no pairs.
shifts=[10, 14, 30, 18, 48]
2
Run checks the first 3 tests in your browser. Submit checks all 86 tests on the server, hidden ones included.