human
Sum of products of all possible Subarrays | Function that finds the sum of products of all subarray of arr [ ].
Stores sum of all subarrays.
Iterate array from behind.
Update the ans.
Update the res.
Print the final sum.
Driver Code.
Given array arr [ ].
Size of array.
Function call"
Solution in Python:
 ... Write me a code to sum of products of all possible Subarrays and the other steps required?
assistant
#Here is code to sum of products of all possible Subarrays and the other steps required.
 def sumOfSubarrayProd ( arr , n ) :
	ans = 0
	res = 0
	i = n - 1
	while ( i >= 0 ) :
		incr = arr [ i ] * ( 1 + res )
		ans += incr
		res = incr
		i -= 1
	print ( ans )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 2 , 3 ]
	N = len ( arr )
	sumOfSubarrayProd ( arr , N )