Back to problems

Contains Duplicate III (Bucket Sort)

Algorithm · Waymo · Hard

Requirements Implement contains_nearby_almost_duplicate(nums, indexDiff, valueDiff). Given an integer array nums, return true when there are two different positions i and j satisfying both conditions: i - j <= indexDiff nums[i] - nums[j] <= valueDiff Return false if no such pair exists. Both indexDiff and valueDiff are nonnegative integers. Examples Example 1 The two 1 values are three positions apart and have a difference of zero. Example 2 Every pair within two indices…

Checking your access…