human
Maximum area rectangle by picking four sides from array | function for finding max area.
sort array in non - increasing order.
Initialize two sides of rectangle.
traverse through array.
if any element occurs twice store that as dimension.
return the product of dimensions.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to maximum area rectangle by picking four sides from array and the other steps required.
 def findArea ( arr , n ) :
	arr . sort ( reverse = True )
	dimension = [ 0 , 0 ]
	i = 0
	j = 0
	while ( i < n - 1 and j < 2 ) :
		if ( arr [ i ] == arr [ i + 1 ] ) :
			dimension [ j ] = arr [ i ]
			j += 1
			i += 1
		i += 1
	return ( dimension [ 0 ] * dimension [ 1 ] )
arr = [ 4 , 2 , 1 , 4 , 6 , 6 , 2 , 5 ]
n = len ( arr )
print ( findArea ( arr , n ) )