#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
bool containsNearbyDuplicate(int* nums, int numsSize, int k)
{
int i=0,j=0;
if(numsSize > k)
{
for(i=0;i<numsSize-k;i++)
{
for(j=i+1;j<=i+k;j++)
{
if(nums[i] == nums[j])
return true;
}
}
for(i=numsSize-k;i<numsSize;i++)
{
for(j=i+1;j<numsSize;j++)
if(nums[i] == nums[j])
return true;
}
}
else
{
for(i=0;i<numsSize;i++)
{
for(j=i+1;j<numsSize;j++)
if(nums[i] == nums[j])
return true;
}
}
return false;
}
int main()
{
int nums[2] = {1,1};
bool r = containsNearbyDuplicate(nums,2,2);
printf("containsNearbyDuplicate is : %d \n",r);
}