Can't we modify value of unordered map? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can't we modify value of unordered map?

Hi All I am getting time limit error when I try to modify value in unordered map... Please refer line 65 in attached code: Is it not possible or Am I missing something? Thanks for your help in advance 👍 https://code.sololearn.com/crlS14DO8EvC/?ref=app

25th Jul 2020, 12:59 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Answers
- 1
the problem is with the "if" statement condition (line 60). the correct is → if (itr == um.end())
25th Jul 2020, 4:46 PM
MO ELomari
+ 2
Opps ...copy paste typo nd then just focused on map value update rather than checking condition... Thanks a lot...!!
25th Jul 2020, 4:50 PM
Ketan Lalcheta
Ketan Lalcheta - avatar