input: Write a function to find the second largest number in an array.
  assert second_largest([10, 20, 4, 45, 99]) == 45
  assert second_largest([70, 11, 50, 40]) == 50
  assert second_largest([1, 2, 3, 4, 5]) == 4
output: def second_largest(arr):
      if len(arr) < 2:
          return None
      
      first, second = float('-inf'), float('-inf')
      
      for num in arr:
          if num > first:
              second = first
              first = num
          elif first > num > second:
              second = num
      
      return second