human
Sum of the updated array after performing the given operation | Utility function to return the sum of the array.
Function to return the sum of the modified array.
Subtract the subarray sum.
Sum of subarray arr [ i ... n - 1 ].
Return the sum of the modified array.
Driver code"
Solution in Python:
assistant
#Here is code to sum of the updated array after performing the given operation and the other steps required.
 def sumArr ( arr , n ) :
	sum = 0 ;
	for i in range ( n ) :
		sum += arr [ i ] ;
	return sum ;
def sumModArr ( arr , n ) :
	subSum = arr [ n - 1 ] ;
	for i in range ( n - 2 , - 1 , - 1 ) :
		curr = arr [ i ] ;
		arr [ i ] -= subSum ;
		subSum += curr ;
	return sumArr ( arr , n ) ;
arr = [ 40 , 25 , 12 , 10 ] ;
n = len ( arr ) ;
print ( sumModArr ( arr , n ) ) ;