fastest way to check if a vector is sorted or not 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;