Search
⌘K

Leetcode 220. Contains Duplicate III

Given an array and integers indexDiff and valueDiff, determine whether there exist distinct indices i and j with |i - j| ≤ indexDiff and |nums[i] - nums[j]| ≤ valueDiff. The core challenge is maintaining a sliding window of the last indexDiff values and quickly detecting any value within valueDiff of the current element (often solved using an ordered set or bucketization).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.