Grokking Oracle Coding Interview
Ask Author
Back to course home

0% completed

Solution: Pairs of Songs With Total Durations Divisible by 60

Problem Statement

You are given a list of positive integer times, where times[i] represents the duration of i<sup>th</sup> song in seconds.

Return the number of unique song pairs for which their total duration in seconds is multiple of 60. In other words, find the number of indices i, j such that i < j with (times[i] + times[j]) % 60 == 0.

Examples

Example 1:

  • Input: times = [30, 20, 150, 100, 40, 110]
  • Expected Output: 3

.....

.....

.....

Like the course? Get enrolled and start learning!