DIY: Monotonic Array
Solve the interview question "Monotonic Array" in this lesson.
Problem statement
An array is monotonic if it is either monotone increasing or monotone decreasing.
An array, arr,
is monotone increasing if arr[i] <= arr[i + 1]
for every element at each index i
. ...