Monotonic Array

Easy
Arrays Array

Return true if array is monotonically increasing or decreasing.

Constraints

1 ≤ len ≤ 10^5

Examples

Example 1:
Input: 1 2 2 3
Output: true
Example 2:
Input: 6 5 4 4
Output: true
▲ Console
📱

Install Talent Enrich

Get instant access to jobs and career tools on your device.