Two-track slot fill
Your task
A radio show has a slot of exactly slot seconds left and wants to fill it with two tracks whose durations (in seconds) add up to slot exactly. The two tracks must come from different positions in the durations list, though their durations may be equal. Return the chosen pair as [shorter, longer] in ascending order. If several pairs fit, return the one whose shorter duration is smallest; if no pair fits, return an empty list. For example, durations [180, 240, 120, 300] with slot 420 gives [120, 300] rather than [180, 240].
Examples
duet_fill(durations: list[int], slot: int) -> list[int]Example 1
Input
duet_fill([180, 240, 120, 300], 420)Output
[120, 300]