class Solution(object):
def containsNearbyDuplicate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: bool
"""
if len(list(set(nums))) == len(nums):return False
for i in range(len(nums)):
for j in range(i+1,len(nums)):
if nums[i]==nums[j] and abs(ij)<=k:
return True
if abs(ij)>k:
j = len(nums)
return False
Beat 100% Python


@SmallerWhale said in Beat 100% Python:
if abs(ij)>k:
j = len(nums)What is it doing? If it's needed in the code?