Objective
Write a function that reports whether the first n values of a are in ascending order, where two equal neighbours still count as ordered.
Steps
$ const int a[] = {1, 2, 2, 5}; is_sorted(a, 4);
1
$ const int a[] = {4, 1, 9}; is_sorted(a, 3);
0
$ const int a[] = {7}; is_sorted(a, 0);
1
$ const int a[] = {INT_MIN, INT_MAX}; is_sorted(a, 2);
1
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Objective
Write a function that reports whether the first n values of a are in ascending order, where two equal neighbours still count as ordered.
Steps
$ const int a[] = {1, 2, 2, 5}; is_sorted(a, 4);
1
$ const int a[] = {4, 1, 9}; is_sorted(a, 3);
0
$ const int a[] = {7}; is_sorted(a, 0);
1
$ const int a[] = {INT_MIN, INT_MAX}; is_sorted(a, 2);
1
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Tests
Run the tests to grade your code