for(int i = 1; i < n; i++){ if(arr[i] >= arr[i-1]){ // ok, continue } else { return false; }}return true;Reference
Check if an Array Is Sorted
A single linear pass comparing each element to the previous one.
views 0