0

If I write this

ans += st.top().first;

my program runs fine but if I replace it with this

ans = ans + st.top().first;

which is one at same it comes time limit exceeded. Can someone please tell me?

myeongkil kim
  • 2,465
  • 4
  • 16
  • 22
dml
  • 1
  • 1
  • 1
    Does this answer your question? [+= Operator in C++](https://stackoverflow.com/questions/34465848/operator-in-c) – myeongkil kim Feb 10 '21 at 10:29
  • @myeongkilkim No, I am getting the error of time limit exceeded so that question does not answer to my problem – dml Feb 10 '21 at 11:03
  • Search the difference in `operator+=` and `operator+` code that is called in these lines. You can find the called operators by stepping into them while debugging this code. – nevilad Feb 10 '21 at 14:22
  • Is `ans` a variable you defined, or some magic specific to the challenge evaluator? – Ben Voigt Feb 10 '21 at 15:55

0 Answers0