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

[42, 86, 7, 78, 77, 64, 72, 81, 67, 69]
2

[55, 68, 64, 80, 5, 87, 39, 88, 73, 45]
2

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

2