You are given an array of integers, check if it is monotonic or not. If the array is monotonic, then return 1, else return 2. An array is monotonic if it is either monotonically increasing or monotonocally decreasing. An array is monotonically increasing/decreasing if its elements increase/decrease as we move from left to right

Q: [6, 62, 90, 10, 27, 71, 40, 67, 64, 47]

A: 2
****
Q: [175, 167, 159, 151, 143, 135, 127, 119, 111, 103, 95, 87, 79, 71, 63, 55, 47, 39, 31]

A: 1
****
Q: [78, 26, 59, 51, 65, 86, 57, 47, 64, 91]

A:
2
****