Driver method to test above method
int main ( ) { int arr [ ] = { 10 , 5 , 3 , 4 , 3 , 5 , 6 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; if ( checkDuplicatesWithinK ( arr , n , 3 ) ) cout << " Yes " ; else cout << " No " ; }