Contains Nearby Duplicate

Easy · Hashing · about 10 minutes

Asked at Amazon, Apple, Microsoft.

Decide whether some value in nums repeats within a short distance: two different positions i and j holding equal values with |i - j| <= k.

Related guides