โ back to unit
Medium
# puzzle gauntlet medium
The Dance Partners
Dance pairs work best when heights are close. The teacher counts the workable pairs. ๐๐บ
You get the heights and the max difference d. Print how many pairs of dancers differ by at most d.
Example:
Input: heights = [120, 125, 140, 122], d = 5
Output: 3
Checking every pair, the differences are 5, 20, 2, 15, 3, 18 โ three of them (5, 2, 3) are at most 5.
๐ก need a hint?
pg-dance-partners.py๐ given lines are locked โ write your code in between
loading...