human
Minimize number of boxes by putting small box inside bigger one | Function to minimize the count.
Initial number of box.
Sort array of box size in increasing order.
Check is current box size is smaller than next box size.
Decrement box count Increment current box count Increment next box count.
Check if both box have same size.
Print the result.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to minimize number of boxes by putting small box inside bigger one and the other steps required.
 def minBox ( arr , n ) :
	box = n
	arr . sort ( )
	curr_box , next_box = 0 , 1
	while ( curr_box < n and next_box < n ) :
		if ( arr [ curr_box ] < arr [ next_box ] ) :
			box = box - 1
			curr_box = curr_box + 1
			next_box = next_box + 1
		elif ( arr [ curr_box ] == arr [ next_box ] ) :
			next_box = next_box + 1
	print ( box )
size = [ 1 , 2 , 3 ]
n = len ( size )
minBox ( size , n )