Driver method to test above method
let arr = [ 10 , 5 , 3 , 4 , 3 , 5 , 6 ] ; let n = arr . length ; if ( checkDuplicatesWithinK ( arr , n , 3 ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }