bool containsNearbyDuplicate(int* nums, int numsSize, int k) { |
int i, j; |
for(i=0; i<numsSize; i++) |
{ |
for(j=1; j<=k; j++) |
{ |
if(i+j <= numsSize-1) |
{ |
if(nums[i] == nums[i+j]) |
return true; |
} |
else |
break; |
} |
} |
return false; |
} |
LeetCode Contains Duplicate II
最新推荐文章于 2020-02-07 15:16:07 发布