human
Give me a code to maximum Product Cutting and the other steps required given the following:
Maximum Product Cutting | DP | The main function that returns the max possible product.
n equals to 2 or 3 must be handled explicitly.
Keep removing parts of size 3 while n is greater than 4.
Keep multiplying 3 to res.
The last part multiplied by previous parts.
Driver program to test above functions"
Solution in Python:
assistant
#Here is code to maximum Product Cutting and the other steps required.
 def maxProd ( n ) :
	if ( n == 2 or n == 3 ) :
		return ( n - 1 )
	res = 1
	while ( n > 4 ) :
		n -= 3 ;
		res *= 3 ;
	return ( n * res )
print ( " Maximum ▁ Product ▁ is ▁ " , maxProd ( 10 ) ) ;