human
Partition problem | DP | Returns true if arr [ ] can be partitioned in two subsets of equal sum , otherwise false.
calculate sum of all elements.
initialize top row as true.
initialize leftmost column , except part [ 0 ] [ 0 ] , as 0.
fill the partition table in bottom up manner.
uncomment this part to print table.
Driver Code.
Function call"
Solution in Python:

What is a code to partition problem and the other steps required?
assistant
#Here is code to partition problem and the other steps required.
 def findPartition ( arr , n ) :
	sum = 0
	i , j = 0 , 0
	for i in range ( n ) :
		sum += arr [ i ]
	if sum % 2 != 0 :
		return false
	part = [ [ True for i in range ( n + 1 ) ] for j in range ( sum // 2 + 1 ) ]
	for i in range ( 0 , n + 1 ) :
		part [ 0 ] [ i ] = True
	for i in range ( 1 , sum // 2 + 1 ) :
		part [ i ] [ 0 ] = False
	for i in range ( 1 , sum // 2 + 1 ) :
		for j in range ( 1 , n + 1 ) :
			part [ i ] [ j ] = part [ i ] [ j - 1 ]
			if i >= arr [ j - 1 ] :
				part [ i ] [ j ] = ( part [ i ] [ j ] or part [ i - arr [ j - 1 ] ] [ j - 1 ] )
	return part [ sum // 2 ] [ n ]
arr = [ 3 , 1 , 1 , 2 , 2 , 1 ]
n = len ( arr )
if findPartition ( arr , n ) == True :
	print ( " Can ▁ be ▁ divided ▁ into ▁ two " , " subsets ▁ of ▁ equal ▁ sum " )
else :
	print ( " Can ▁ not ▁ be ▁ divided ▁ into ▁ " , " two ▁ subsets ▁ of ▁ equal ▁ sum " )