Message from C, C++ talks

June 2019

— I read that

— This doesn't works for 4 5 3 2 1 6

— User Evil has 2/3 warnings; be careful!
The latest warn was because:

— 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.

Message permanent page


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.

Message permanent page

— What OS do you use?

— Vim

— I use ubuntu 18.04

— No vim is not an IDE but an editor

— You can install plugins to make it more like an IDE

— Why do you say its best?

— Visual studio code or qt creator or clion. if you want gui