Find the String having each substring with exactly K distinct characters | Function to find the required output string ; Each element at index i is modulus of K ; initialise integers N and K
function findString ( N , K ) { for ( let i = 0 ; i < N ; i ++ ) { document . write ( String . fromCharCode ( ' ' . charCodeAt ( ) + i % K ) ) ; } } let N = 10 ; let K = 3 ; findString ( N , K ) ;