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

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

[169, 162, 155, 148, 141, 134, 127, 120, 113, 106, 99, 92, 85, 78, 71, 64, 57, 50, 43, 36, 29, 22, 15]
1

[71, 45, 54, 41, 73, 74, 32, 38, 53, 18]
2