Check if Array is Sorted Solution
unknown
c_cpp
a year ago
275 B
6
Indexable
int isSorted(int n, vector<int> a) { // Write your code here. int sortedStatus = 1; for(int i = 0; i< n - 1; i++){ if(a[i]> a[i + 1]){ sortedStatus = 0 ; return sortedStatus; } } return sortedStatus; }
Editor is loading...
Leave a Comment