class Solution { public boolean containsNearbyDuplicate(int[] nums, int k) { Map map = new HashMap<>(); for(int i=0; i