A bitonic array is an array that starts strictly increasing and then strictly decreasing. Given a bitonic array arr of distinct integers, find the maximum element in the array. You may assume that the array always contains at least one element.

Function Signature:

from typing import List

def bitonic_array_maximum(arr: List[int]) -> int:
    """
    Find the maximum element in a bitonic array.

    Parameters:
    - arr: A bitonic array of distinct integers.

    Returns:
    - int: The maximum element in the array.
    """
    # Your code here

Example:

arr = [1, 3, 8, 12, 4, 2]
result = bitonic_array_maximum(arr)
print(result)  # Output should be 12
# Explanation: The array starts strictly increasing from 1 to 12 and then strictly decreasing.
# The maximum element in the array is 12.

Note:

  • The input array arr is guaranteed to be a bitonic array of distinct integers.
  • The array always contains at least one element.

Instructions:

  • Implement the bitonic_array_maximum function to solve the problem.
  • Use Python for your implementation.
  • Provide clear comments in your code to explain the logic.
  • Discuss the time and space complexity of your solution.

As always, we’ll share our solution to this problem tomorrow. Stay tuned 😊