exelover's blog

By exelover, history, 7 years ago, In English
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
7 years 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