i was seeing a solution of my question and i encountered this statement — "since we need to do some deletions here, we cant use vectors, since its not directly possible in vectors." my question is that dont we have the erase() function in vectors? then why not use it?
Because erase() function is too slow. It has a complexity of $$$O(size)$$$