#3357
Minimize the Maximum Adjacent Element Difference
grandmaster · 2220 · lc hard +32 · 19.6% accepted · 63 likes · top 1%
Description
You are given an array of integers nums where some values are missing, denoted by -1.
Choose a pair of positive integers (x, y) exactly once and replace every -1 in the array with either x or y.
Minimize the maximum absolute difference between adjacent elements of the resulting array.
Return this minimum possible difference.
Code
1
2
3