prices and an integer count. Choose exactly count different positions from the list (different positions may hold the same price).
The variety of a choice is the smallest absolute price difference over all pairs of chosen positions.
Return the largest variety you can achieve.prices=[12, 3, 30, 7, 19], count=3 → 11
Take prices 3, 19 and 30: the pairwise differences are 16, 27 and 11, the smallest being 11. Nothing does better.
prices=[5, 5, 9], count=2 → 4
Take 5 and 9, with a difference of 4.
prices=[2, 2, 2], count=3 → 0
prices=[12, 3, 30, 7, 19], count=3
11
Run checks the first 3 tests in your browser. Submit checks all 83 tests on the server, hidden ones included.