— User Evil has 2/3 warnings; be careful! The latest warn was because: spam
— Ah, shi.. yes, incrementing one with that condition was a stupid inea.
Then.. we can create a new bool flag, representing whether the last processed item was good or going to be deleted. Set it to true, when we in p[i] > pre block and set it to false in the else block of this if. And in the beginning of the block where we setting it to false do
if (isValueWasBad) count++;
So we will still increment the value in case we shold have one as the answer.
Remove value from vector is too inefficient. try to build a new vector only from required values. without removing elements by one
— So what’s your problem
— Suggest best IDE for C++
— If you about what I wrote, I used "removing" to refer to part of the original alghoritm, that is being analyzed. So no removement is needed now. You can find the task and some code examples above, if you're interested.