Generate an N | Function to generate a String of length N having longest palindromic subString of length K ; Fill first K characters with ' a ' ; Stores a non - palindromic sequence to be repeated for N - k slots ; Print N - k remaining characters ; Given N and K
function String_palindrome ( N , K ) { for ( let i = 0 ; i < K ; i ++ ) document . write ( " " ) ; let s = " " ; for ( let i = 0 ; i < N - K ; i ++ ) document . write ( s [ i % 3 ] ) ; } let N = 5 , K = 3 ; String_palindrome ( N , K ) ;