Check if an Array Is Sorted
Decide whether an array is in non-decreasing order.
Input format
The first line contains N. The second line contains N space-separated integers.
Output format
Print true if the array is sorted in non-decreasing order (each element is not smaller than the one before it), otherwise false.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
4
1 2 3 4Expected output
trueExample 2
Input
3
3 1 2Expected output
false