+ 1
Correct the element value into set
Tried to implement correcting data into set. https://code.sololearn.com/cYegYCyWDedx Is this the way or there is better solution for this? Edit : Basically my question is about below line : auto itr = s.find("Sachin Ganguly"); if (itr != s.end()) s.erase(itr); s.insert("Sachin Tendulkar"); Can I optimize this as I am trying to do same twice for two different entries. I know that we can't modify value after getting iterator I guess for map and set
3 Respuestas
+ 1
Ketan,
What was meant by correct? is there something incorrect in the code?
0
You can consider this as use case to modify value present into set....
Consider this as data value to be corrected... We are getting "ABC" as one element value but it was needed as "BD".... We can't change value to BD when we inserted into set but later on same need to be modified
0
Updated question with code lines what I am looking for to optimize .