2817. Minimum Absolute Difference Between Elements With Constraint
You are given a 0-indexed integer array
nums
and an integerx
.Find the minimum absolute difference between two elements in the array that are at least
x
indices apart.In other words, find two indices
i
andj
such thatabs(i - j) >= x
andabs(nums[i] - nums[j])
is minimized.Return an integer denoting the minimum absolute difference between two elements that are at least
x
indices apart.
1 | class Solution { |