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

mediumLast edited: August 2, 2025