Find local minimum or maximum in O(1) time in an array with elements differing by plus minus 1