input: Write a function to repopulate missing elements (None) in an array based on the average of their neighbouring elements.
  assert repopulate_missing([1, 2, None, 4, 5]) == [1, 2, 3, 4, 5]
  assert repopulate_missing([None, 2, 3, None, 5]) == [1, 2, 3, 4, 5]
  assert repopulate_missing([None, None, 3, 4, 5]) == [0, 1, 3, 4, 5]
output: def repopulate_missing(arr):
      def average(a, b):
          return (a + b) // 2
      
      n = len(arr)
      for i in range(n):
          if arr[i] is None:
              if i == 0:
                  arr[i] = arr[i + 1] - 1
              elif i == n - 1:
                  arr[i] = arr[i - 1] + 1
              else:
                  arr[i] = average(arr[i - 1], arr[i + 1])
      return arr