UrMoM_iNbEd's blog

By UrMoM_iNbEd, history, 8 days ago, In English,
 
 
 
 

»
8 days ago, # |
  Vote: I like it 0 Vote: I do not like it

The problem is that you erase element from the vector O(n) times. and since the size of the vector is O(n), your time complexity would become O(N^2), which is too slow. You should use queue instead as you are only removing the top element.

Spoiler