Available question text
Given an array nums and integer x, find the minimum |nums[i] - nums[j]| over all index pairs with |i - j| >= x. The core challenge is maintaining a searchable set of values at least x apart (e.g., a sliding window with an ordered set) to efficiently query the closest neighbor for each element in O(n log n) time for n up to 1e5.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2817. Minimum Absolute Difference Between Elements With Constraint
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source