Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Can we use binary search here?
Suppose that the answer is <code>x</code>. We can find a valid configuration of integers by sorting <code>start</code>, the first integer should be <code>start[0]</code>, then each subsequent integer should be the smallest one in <code>[start[i], start[i] + d]</code> that is greater than <code>last_chosen_value + x</code>.
Binary search over <code>x</code>