Sobes.tech
Intern — Middle

Removing all elements equal to one from std::vector

livecode

Task condition

It is necessary to remove all values of 1 present in the vector container using the most efficient approach.

std::vector<int> vec = {1, 5, 4, 1, 10, 1, 33, 300};
// remove all elements equal to 1