input: Write a function to determine if an array of numbers can be transformed into a sorted array in non-decreasing order by performing any number of left or right shift operations. If it is possible, return True; otherwise, return False. If the array is empty, return True.
  
  def can_be_sorted_by_shifts(arr):
      if not arr:
          return True
      n = len(arr)
      sorted_arr = sorted(arr)
      for i in range(n):
          if arr[i:] + arr[:i] == sorted_arr:
              return True
      return False
  
  assert can_be_sorted_by_shifts([3, 4, 5, 1, 2]) == True
  assert can_be_sorted_by_shifts([3, 5, 10, 1, 2]) == True
  assert can_be_sorted_by_shifts([4, 3, 1, 2]) == False
  assert can_be_sorted_by_shifts([3, 5, 4, 1, 2]) == False
  assert can_be_sorted_by_shifts([]) == True
output: def can_be_sorted_by_shifts(arr):
      if not arr:
          return True
      n = len(arr)
      sorted_arr = sorted(arr)
      for i in range(n):
          if arr[i:] + arr[:i] == sorted_arr:
              return True
      return False