Contains Duplicate II

Given an integer array nums and an integer k, return true if there are two distinct indices i and j such that nums[i] == nums[j] and |i - j| <= k. Otherwise, return false.

Examples
Input: [[1,2,3,1],3]
Output: true
Hints

Contains Duplicate II

Given an integer array `nums` and an integer `k`, return `true` if there are two distinct indices `i` and `j` such that `nums[i] == nums[j]` and `|i - j| <= k`. Otherwise, return `false`.