Search
⌘K

Leetcode 219. Contains Duplicate II

Determine whether the array contains two equal elements whose indices differ by at most k — i.e., detect duplicates within a sliding window of size k+1 (array length up to 1e5, so an O(n) lookup-based approach is expected).

Asked at:

Meta

Amazon

Amazon


Question Timeline

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

Early January, 2026

Meta

Mid-level

Late July, 2025

Meta

Senior

Asked as it appears on LC

Mid March, 2025

Amazon

Amazon

Mid-level

Comments

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