FastPrepSong Duration Pairs Divisible by 60
Problems/Song Duration Pairs Divisible by 60

Song Duration Pairs Divisible by 60

The Walt Disney Company logoThe Walt Disney Company● EasyFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks to find song pairs whose total duration is divisible by 60. It does not specify an interface, a count-only result or an LC number. This practice follows that literal pair-finding seed by returning all zero-based i<j index pairs; repeated durations remain distinct songs. Bounds, seconds, full enumeration and lexicographic ordering are authored conventions. About 80% of the reported task scope is represented, as an editorial estimate rather than original-code similarity.

Given a playlist of song durations in seconds, find pairs whose total duration is divisible by 60.

For this exercise, return every zero-based index pair [i,j] with i<j and (durations[i]+durations[j]) % 60 == 0. Distinct songs with equal durations still have distinct indices. Return pairs in lexicographic order: first by i, then by j. Return an empty list if none exist.

Function

songPairs(durations: int[]) → List<List<Integer>>

Examples

Example 1

durations = [10,50,70,110]return = [[0,1],[0,3],[1,2],[2,3]]

The valid index pairs are [0,1], [0,3], [1,2] and [2,3], with sums 60, 120, 120 and 180 seconds.

Example 2

durations = [60,60,60]return = [[0,1],[0,2],[1,2]]

All three pairs of distinct indices are valid: [0,1], [0,2] and [1,2].

Constraints

  • 0 <= durations.length <= 60
  • 1 <= durations[i] <= 1000000

More The Walt Disney Company problems

  • Find All Paths for a Name in a File SystemPHONE SCREEN · Seen Nov 2026
  • Resizable Array-Backed Integer SetPHONE SCREEN · Seen Sep 2026
  • Shortest Path with Directional Move CostsPHONE SCREEN · Seen Sep 2026
All The Walt Disney Company interview questionsSee The Walt Disney Company hiring insights
Saved
class Solution {
    public List<List<Integer>> songPairs(int[] durations) {
        // Write your code here
    }
}
Checking account…