Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

C_o_d_e__'s blog

By C_o_d_e__, history, 2 years 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?
»
2 years 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.