values. Any element may be changed any number of times with one of two moves:
- if the number is **even**, divide it by 2;
- if the number is **odd**, multiply it by 2.
The **spread** of the array is the difference between its largest and smallest elements. Return the smallest spread you can reach with these moves.values=[6, 3, 10] → 1
Double the 3 into 6 and halve the 10 into 5: the array becomes [6, 6, 5] with a spread of 6 − 5 = 1. A spread of 0 is impossible: 10 can only be 10 or 5, and 3 can only be 3 or 6.
values=[7, 28] → 0
Halve 28 twice to get 7, and the two numbers are equal.
values=[5, 9, 40] → 1
values=[6, 3, 10]
1
Run checks the first 3 tests in your browser. Submit checks all 102 tests on the server, hidden ones included.