check if vector is sorted c++ code example
Example: c++ check if vector is sorted
for(int i = 0; i < n.size()-1; i++)
if(n[i] > n[i+1])
return false;
return true;
for(int i = 0; i < n.size()-1; i++)
if(n[i] > n[i+1])
return false;
return true;