human
Maximum absolute difference of value and index sums | Function to return maximum absolute difference in linear time ..
max and min variables as described in algorithm ..
Updating max and min variables as described in algorithm ..
Calculating maximum absolute difference ..
Driver program to test above function"
Solution in Python:
assistant
#Here is code to maximum absolute difference of value and index sums and the other steps required.
 def maxDistance ( array ) :
	max1 = - 2147483648
	min1 = + 2147483647
	max2 = - 2147483648
	min2 = + 2147483647
	for i in range ( len ( array ) ) :
		max1 = max ( max1 , array [ i ] + i )
		min1 = min ( min1 , array [ i ] + i )
		max2 = max ( max2 , array [ i ] - i )
		min2 = min ( min2 , array [ i ] - i )
	return max ( max1 - min1 , max2 - min2 )
array = [ - 70 , - 64 , - 6 , - 56 , 64 , 61 , - 57 , 16 , 48 , - 98 ]
print ( maxDistance ( array ) )