Find max and min in the array in a speed of O(3n/2)