Divide an Array Into Subarrays With Minimum Cost II
Fix the second start, then take the cheapest k - 2 values in the window of starts that stay within dist.
Fix the second start, then take the cheapest k - 2 values in the window of starts that stay within dist.