1/13
Loading...
🎤Duet Pitch Matching
From the sorted pitch scores, find the pair whose sum is closest to the target harmony value 60. Start from both ends and steer the sum toward 60!
Loading...
From the sorted pitch scores, find the pair whose sum is closest to the target harmony value 60. Start from both ends and steer the sum toward 60!
In the singing-practice app 'Harmony', you pick two members to sing a duet. Each member has a pitch score, and the closer the sum of two members' scores is to the target harmony value T, the better the duet blends. There may be no pair summing to exactly T, so choose the two members whose sum is closest to T. Member scores are given pre-sorted in ascending order.
6 60 12 18 25 33 41 50
59
18 + 41 = 59 has the smallest gap of 1 from the target 60.
4 10 1 4 9 11
10
1 + 9 = 10 matches the target exactly.