int end = nums.size() - 1;
int start = 0;
while (start < end) {
if (nums[start] == k) {
nums.push_back(nums[start]);
nums.erase(nums.begin() + start);
}
}
Given a value of k I want to be able to send it to the end of an array and remove it from where it was
I'm only showing the part where id like optimized but I don't know what else to use aside from erase()
I don't want to use erase() because it would give me a O(N^2) complexity when I want to try and achieve a O(N) complexity
Thanks