array

input[i] = input[j]

j-i <= k

i,j: indices

k: input (denotes neighborhood)

Examples:

Input : {1,2,3,4,5,2} k : 2 Output : false Input : {1,2,3,4,5,2} k : 5 Output : true

public static boolean hasKNearestDuplicate(int[] input, int k) { }