C_o_d_e__'s blog

By C_o_d_e__, history, 23 months 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

| Write comment?
»
23 months ago, hide # |
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.