mercredi 2 décembre 2015

How to get index of first non zero value in a vector

What is the best way to do this.

For eg. I have

Vector<int> temp = {0,0,1,0,2}

I want to get the index of first non-zero value in the temp. So in this case I want answer 2.

Thanks, Gunjan

Aucun commentaire:

Enregistrer un commentaire