def generateDeltaArray(input_arr):
  """generates delta array for given array
  e.g. [4,12,15,22] -> [4,8,3,7]
  """
  input_len = len(input_arr)
  assert input_len > 0, 'Empty array is given'
  deltas = [None] * input_len
  deltas[0] = input_arr[0]
  idx = 1
  while idx < input_len:
    deltas[idx] = input_arr[idx]-input_arr[idx-1]
    idx+=1
  return deltas