_punk's blog

By _punk, history, 7 years ago, In English

whenever you are doing a question in which addition to a string requires , that is , we have to add an character into a string or we have to insert into a stack. Then instead of using '+' operator go for push_back. this help in lot of questions where you are doing a lot of '+' operation in a string. i got this when i was solving a question on geeks and i found TLE many times. Then I tried roughly push_back, and BOOM it worked XD. Thats where i learnt when you are not getting your answer when you are right , then go for rough guesses.

HAPPY CODING :)

  • Vote: I like it
  • +12
  • Vote: I do not like it

»
7 years ago, hide # |
Rev. 2  
Vote: I like it +32 Vote: I do not like it

You can use += also. This hack allows you to add a string to the right for O(the length of the string wich you want to add). For example, a += b working for O( len(b) )

»
7 years ago, hide # |
 
Vote: I like it +20 Vote: I do not like it

Thats where i learnt when you are not getting your answer when you are right , then go for rough guesses.

Shit one says when he/she don't know computer science.