If previous character is '1' then we put only 0 at end of string example str = "01" then new string be "010"
if ( str [ n - 1 ] == ' ' ) { str [ n ] = ' ' ; generateAllStringsUtil ( K , str , n + 1 ) ; }