0 out of 464 challenges solved
Write a Python function `max_abs_diff(arr)` that takes a list of integers `arr` and returns the maximum absolute difference between any two elements in the array. #### Example Usage: ```python [main.nopy] print(max_abs_diff([2, 1, 5, 3])) # Output: 4 print(max_abs_diff([9, 3, 2, 5, 1])) # Output: 8 print(max_abs_diff([3, 2, 1])) # Output: 2 ``` #### Constraints: - The input list will have at least two elements. - The elements of the list are integers.
def max_abs_diff(arr): """ Calculate the maximum absolute difference between any two elements in the array. Args: arr (list): A list of integers. Returns: int: The maximum absolute difference between any two elements. """ # Placeholder for the solution pass