Accessing iterator after erasing it from set?

Revision en1, by Iiinertia_1412, 2022-10-15 21:40:00

Here are two codes for question- Your text to link here...

code 1-Your text to link here...

code 2-Your text to link here...

In code 1 iterator is erased first and dereferenced after that.(Runtime error at test 39).

In code 2 iterator is dereferenced first and erased from set after that.(Accepted)

If code 1 is wrong practice why it got accepted for 38 test cases?

Tags set, iterator

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Iiinertia_1412 2022-10-15 21:40:00 597 Initial revision (published)