human
Maximum sum obtained by dividing Array into several subarrays as per given conditions | Function to find the required answer.
Stores maximum sum.
Adding the difference of elements at ends of increasing subarray to the answer.
Input.
Functio calling"
Solution in Python:
 What is a code to maximum sum obtained by dividing Array into several subarrays as per given conditions and the other steps required?
assistant
#Here is code to maximum sum obtained by dividing Array into several subarrays as per given conditions and the other steps required.
 def maximumSum ( arr , N ) :
	Sum = 0 ;
	for i in range ( 1 , N ) :
		if ( arr [ i ] > arr [ i - 1 ] ) :
			Sum += ( arr [ i ] - arr [ i - 1 ] )
	return Sum ;
arr = [ 1 , 5 , 3 ] ;
N = len ( arr )
print ( maximumSum ( arr , N ) ) ;