Lexicographically smallest numeric string having odd digit counts | Function to construct lexicographically smallest numeric string having an odd count of each characters ; Stores the resultant string ; If N is even ; Otherwise ; Driver code
function genString ( N ) { let ans = " " ; if ( N % 2 == 0 ) { ans = ' ' . repeat ( N - 1 ) + ' ' ; } else { ans = ' ' . repeat ( N ) ; } return ans ; } let N = 5 ; document . write ( genString ( N ) ) ;