#36 - Check if array is sorted or not

You are given an array of integers. Your task is to implement a function to check if the array is sorted in either non-decreasing or non-increasing order.

nums = [1, 4, 9, 10, 15]
True

nums = [14, 11, 9, 4, 1]
True

nums = [5, 2, 9, 4, 7]
False

Last updated