The function below uses slices to get the maximum value between 2 indexes at once. So it gets the maximum value between 0 and 10 and then 10 and 12 and
0 and 10
10 and 12