Store string that are initially have formed lexicographically smallest 2 k length substring
var temp_str = " " ; for ( var i = 0 ; i < zeroes_in_2k / 2 ; i ++ ) { temp_str += " " ; } for ( var i = 0 ; i < ones_in_2k ; i ++ ) { temp_str += " " ; } for ( var i = 0 ; i < zeroes_in_2k / 2 ; i ++ ) { temp_str += " " ; }