data_structures.arrays.monotonic_array

Functions

is_monotonic(→ bool)

Check if a list is monotonic.

Module Contents

data_structures.arrays.monotonic_array.is_monotonic(nums: list[int]) bool

Check if a list is monotonic.

>>> is_monotonic([1, 2, 2, 3])
True
>>> is_monotonic([6, 5, 4, 4])
True
>>> is_monotonic([1, 3, 2])
False