human
Print indices of pair of array elements required to be removed to split array into 3 equal sum subarrays | Function to check if array can be split into three equal sum subarrays by removing a pair.
Stores prefix sum array.
Traverse the array.
Stores sums of all three subarrays.
Sum of left subarray.
Sum of middle subarray.
Sum of right subarray.
Check if sum of subarrays are equal.
Prthe possible pair.
If no such pair exists , pr - 1.
Driver Code.
Given array.
Size of the array"
How can the above be solved in Python?
 What is a code to print indices of pair of array elements required to be removed to split array into 3 equal sum subarrays and the other steps required?
assistant
#Here is code to print indices of pair of array elements required to be removed to split array into 3 equal sum subarrays and the other steps required.
 def findSplit ( arr , N ) :
	sum = [ i for i in arr ]
	for i in range ( 1 , N ) :
		sum [ i ] += sum [ i - 1 ]
	for l in range ( 1 , N - 3 ) :
		for r in range ( l + 2 , N - 1 ) :
			lsum , rsum , msum = 0 , 0 , 0
			lsum = sum [ l - 1 ]
			msum = sum [ r - 1 ] - sum [ l ]
			rsum = sum [ N - 1 ] - sum [ r ]
			if ( lsum == rsum and rsum == msum ) :
				print ( l , r )
				return
	print ( - 1 )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 2 , 5 , 12 , 7 , 19 , 4 , 3 ]
	N = len ( arr )
	findSplit ( arr , N )