Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
We need to get the max and min value after changing num and the answer is max - min.
Use brute force, try all possible changes and keep the minimum and maximum values.