Practice Minimize the Maximum Adjacent Element Difference
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given an array of integers nums. Some values in nums are missing and are denoted by -1. You must choose a pair of positive integers (x, y) exactly once and replace each missing element with either x or y. You need to minimize the maximum absolute difference between adjacent elements of nums after replacements. Return the minimum possible difference.
Source: Minimize the Maximum Adjacent Element Difference on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [1,2,-1,10,8]
4
# Example 2
nums = [-1,-1,-1]
0
# Example 3
nums = [-1,10,-1,8]
1
Constraints
Related LeetCode Problems
Practice more problems similar to Minimize the Maximum Adjacent Element Difference.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.