Construct a string of length L such that each substring of length X has exactly Y distinct letters | javascript implementation to construct a string of length L such that each substring of length X has exactly Y distinct letters . ; Initialize p equal to the ASCII value of a ; Iterate till the length of the string ; Driver code
function string ( l , x , y ) { var p = 97 ; for ( var j = 0 ; j < l ; j ++ ) { var ans = String . fromCharCode ( p + ( j % y ) ) ; document . write ( ans ) ; } } var l = 6 ; var x = 5 ; var y = 3 ; string ( l , x , y ) ;