How can I check if vector elements are in order? : I need to check if in my vector the elements are in order

    for(i=1; i<=K; i++)
        if(v[i]=v[i+1]-1)
If the statement would be true I want to return the biggest integer.

> ex. 4 5 6 7

    7