Блог пользователя _punk

Автор _punk, история, 7 лет назад, По-английски

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 :)

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +32 Проголосовать: не нравится

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 лет назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

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.