Sponsored
Use these hints if you're stuck. Try solving on your own first.
For every occurrence of key in nums, find all indices within distance k from it.
Use a hash table to remove duplicate indices.
Solve with full IDE support and test cases