Given an array and an integer k, return true if there are two equal values with indices at most k apart.
Examples
Input:[[1,2,3,1],3]
Output:true
Input:[[1,0,1,1],1]
Output:true
Hints
Use a hash map to store the most recent index of each value as you iterate through the array.
For each element, check if it exists in the hash map and if the difference between the current index and the stored index is ≤ k.
If such a pair is found, return true immediately; otherwise, update the hash map with the current index and continue. If the loop completes without finding such a pair, return false.