def find1Dpeak(arr):
  """
  Finds a 1D peak in a list of comparable types

  A 1D peak is an x in L such that it is greater
  than or equal to all its neighbors.

  ex. [1, 1, 2, 1] in this list, the elements at
  index 0 and index 2 are peaks.

  Complexity: O(log(n))
  where n = len(list)

  """
  n = len(arr)
  if n == 1:
    return arr[0]
  if n == 2:
    return max(arr)
  if arr[n / 2] < arr[(n / 2) - 1]:
    return find1Dpeak(arr[:n / 2])
  if arr[n / 2] < arr[(n / 2) + 1]:
    return find1Dpeak(arr[n / 2:])
  return arr[n / 2]