Is Sorted
Return True if nums never goes down from one item to the next (each item is at least as big as the one before it), otherwise False. A single item counts as sorted.
Example 1
nums [1,2,2,5]
returns true
It never decreases.
Example 2
nums [3,1,2]
returns false
It drops from 3 to 1.
Constraints
1 <= len(nums) <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Is SymmetricEasy
- Largest GapEasy
- Latest PeakEasy
- Merge and SortEasy
- Missing NumbersEasy
- Most Common ValueEasy
- Most Different PositionEasy
- Outlier CountEasy