C_o_d_e__'s blog

By C_o_d_e__, history, 3 weeks ago, In English

lets we have

string s="" , k="abcd";

(1) s=s+a;

(2) s+=a;

  • Vote: I like it
  • -1
  • Vote: I do not like it

»
3 weeks ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

s=s+a; creates a copy of the string so you can get MLE,

s+=a or s.append(a) doesnt creates a copy of the string.