Monotonic Array
Updated Feb 24, 2026
Problem
Return true if array is monotone increasing or decreasing.
Constraints
1 <= nums.length <= 10^5
Examples
Example 1
Input:
{"nums": [1, 2, 2, 3]}
Output:
true
Function Signature
def isMonotonic(self, nums: list[int]) -> bool
How to Submit
Implement a Solution class with a isMonotonic method.
Your method will be called with the input parameters and should return the answer.