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: [17, 24, 31, 38, 45, 52, 59, 66, 73, 80, 87, 94, 101, 108]

A: 1
****
Q: [45, 90, 64, 95, 66, 26, 76, 7, 74, 38]

A: 2
****
Q: [159, 150, 141, 132, 123, 114, 105, 96, 87, 78, 69, 60, 51, 42, 33]

A:
1
****