input: Write a python function to find the second smallest element in an array.
  assert secondSmallest([1, 5, 3, 0, -1]) == 0
  assert secondSmallest([5, 8, 12, 1, 4]) == 4
  assert secondSmallest([10, 20, 30, 40, 50]) == 20
  assert secondSmallest([-2, -3, -1, -4]) == -3
  assert secondSmallest([7, 7, 7, 7]) == float('inf')
output: def secondSmallest(arr):
      if len(arr) < 2:
          return float('inf')
      
      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 if second != float('inf') else float('inf')