Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2817. Minimum Absolute Difference Between Elements With Constraint
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.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.