About this question

Iterator Invalidation with Vector Erase

Hard · Code Analysis · Quant Trader interview question · cpp, iterator, vector, erase, invalidation

Consider the following C++ code snippet: The intent of the code is to remove all even numbers from the vector data. What is the most likely outcome when running this code? Assume the code compiles successfully.