Simple sorted list
Input
is_sorted([1, 2, 2, 3])
Output
True
Each item is less than or equal to the next, so the list is sorted.
Full lesson preview
Determine whether a list is sorted in non-decreasing order.
Problem statement
Task
Examples
Input
is_sorted([1, 2, 2, 3])
Output
True
Each item is less than or equal to the next, so the list is sorted.
Input format
Output format
Constraints
Samples
Input
is_sorted([])
Output
True
Empty list is considered sorted.