0 out of 464 challenges solved
Write a Python function `check_greater(arr, number)` that takes an array of integers `arr` and an integer `number` as input. The function should return `True` if the given number is greater than all elements in the array, and `False` otherwise. #### Example Usage ```python [main.nopy] print(check_greater([1, 2, 3, 4, 5], 4)) # Output: False print(check_greater([2, 3, 4, 5, 6], 8)) # Output: True print(check_greater([9, 7, 4, 8, 6, 1], 11)) # Output: True ```
def check_greater(arr, number):
"""
Check if the given number is greater than all elements in the array.
Args:
arr (list): A list of integers.
number (int): An integer to compare against the array elements.
Returns:
bool: True if the number is greater than all elements, False otherwise.
"""
# Handle the case of an empty array
# Sort the array to find the largest element
# Compare the number with the largest element
pass # Replace this with your implementation