1228. Missing Number In Arithmetic Progression

Given a sorted array arr that represents an arithmetic progression with a constant difference, where exactly one element is missing, return the missing element.

The array may be sorted in ascending or descending order. The missing element is always strictly between the first and last elements, so it is never at either boundary.

Examples
Input: [5,7,11,13]
Output: 9
Hints
Related Problems

1228. Missing Number In Arithmetic Progression

Given a sorted array `arr` that represents an arithmetic progression with a constant difference, where exactly one element is missing, return the missing element.