# Monotonic Arrays

A monotonic array is an array whose elements, from left to right, are entirely non-increasing, or entirely non-decreasing. Return true if the given array is monotonic.

Algorithm for monotonic array (1):

• Check if the array is increasing or decreasing

• If increasing, check if the array is monotonic increasing

• If decreasing, check if the array is monotonic decreasing

• If the array is monotonic increasing, return true

• If the array is monotonic decreasing, return true

• If the array is neither monotonic increasing nor monotonic decreasing, return false

Algorithm for monotonic array (1):

• Check if the array is increasing or decreasing

• If increasing, check if the array is monotonic increasing

• If decreasing, check if the array is monotonic decreasing

• If the array is monotonic increasing, return true

• If the array is monotonic decreasing, return true

• If the array is neither monotonic increasing nor monotonic decreasing, return false

Solve Monotonic Arrays on Algochurn

## Practice all the solutions below

Practice the most popular front-end questions asked in coding interviews with   Frontend Churn