Contains Duplicate 2 - within k distance

Contains Duplicate 2 - within k distance - Coding Problem | K5kC