Блог пользователя exelover

Автор exelover, история, 9 лет назад, По-английски
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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