Given a list \(A = (a_0,\ldots,a_{n-1})\) of \(n\) different integer numbers. A local minimum in a list is an element \(a_i\) such that \(a_i<a_{i-1}\) and \(a_i<a_{i+1}\). Values \(a_0\) en \(a_{n-1}\) are local minima if respectively \(a_0<a_1\) and \(a_{n-1}<a_{n-2}\). Design and implement an algorithm to find a local minimum in a given list. The time complexity of your algorithm should be \(\Theta(\log n)\) in the worst case.

Assignment

Write a Python function findminimum(numbers: list) that takes a list of integers as input and outputs a local minimum.

Example:

>>> findminimum([12, 14, 1, 9, 20]) # both 1 and 12 are also correct
1
>>> findminimum([1, 5, 10, 19, 20])
1
>>> findminimum([5,3,1,0,2,4,6,9,8]) # both 0 and 8 are correct
8