human
Give me a code to find maximum subset sum formed by partitioning any subset of array into 2 partitions with equal sum and the other steps required given the following:
Find maximum subset sum formed by partitioning any subset of array into 2 partitions with equal sum | Function to find the maximum subset sum.
Ignore the current element.
including element in partition 1.
including element in partition 2.
Driver code.
size of the array"
How can the above be solved in Python?
assistant
#Here is code to find maximum subset sum formed by partitioning any subset of array into 2 partitions with equal sum and the other steps required.
 def maxSum ( p0 , p1 , a , pos , n ) :
	if ( pos == n ) :
		if ( p0 == p1 ) :
			return p0 ;
		else :
			return 0 ;
	ans = maxSum ( p0 , p1 , a , pos + 1 , n ) ;
	ans = max ( ans , maxSum ( p0 + a [ pos ] , p1 , a , pos + 1 , n ) ) ;
	ans = max ( ans , maxSum ( p0 , p1 + a [ pos ] , a , pos + 1 , n ) ) ;
	return ans ;
if __name__ == " _ _ main _ _ " :
	n = 4 ;
	a = [ 1 , 2 , 3 , 6 ] ;
	print ( maxSum ( 0 , 0 , a , 0 , n ) ) ;