Problem Overview
"Contains Duplicate III" (LeetCode 220) is a Netflix interview question involving array processing with sliding window, bucket sort, and ordered set techniques. It asks if there are two distinct indices i and j (i ≠ j) in array nums where |i - j| ≤ indexDiff and |nums[i] - nums[j]| ≤ valueDiff. [5][9]
Given an integer array nums and two integers indexDiff and valueDiff, find a pair of indices (i, j) such that:
Return true if such a pair exists, false otherwise.[3][5]
Example 1:
Input: nums =, indexDiff = 3, valueDiff = 0[1][2][3]
Output: true
Explanation: Choose (i=0, j=3). Conditions hold: 0 ≠ 3, |0-3| = 3 ≤ 3, |1-1| = 0 ≤ 0. [5]
Example 2:
Input: nums =, indexDiff = 2, valueDiff = 3[5][9][1]
Output: false
Explanation: No pair satisfies all conditions within the index and value limits.[5]
Example 3 (from solutions):
Input: nums =, indexDiff = 3, valueDiff = 0[2][1][3]
Output: true (reiterates duplicate 1 within window).[1]