Module 7 · Sliding Window · Sliding Window Intro

Contains duplicate II

Two equal values at most k apart: for each i, look back over the window i-k..i. A map of each value's last index answers it in one lookup — a value seen before but further back than k is outside the window, and its last index moves up to i.