Duet Duration Matching
Duet Duration Matching
MediumArrays0% accepted
Priya works for JioSaavn's algorithm team in Pune, developing features to suggest song duets that match a user's desired listening time when played together.
Approach
Given an array of song durations and a target combined duration, find the pair of songs whose sum is closest to the target.
Input
durations=[120,150,180,200,220], target=300
Output
[120,180]
More Arrays problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards