UrMoM_iNbEd's blog

By UrMoM_iNbEd, history, 2 months ago, In English,

2 months 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.