Minimum number of Bottles visible when a bottle can be enclosed inside another Bottle | Python3 code for the above approach ; Driver code ; Find the solution
def min_visible_bottles ( arr , n ) : NEW_LINE INDENT m = dict ( ) NEW_LINE ans = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT m [ arr [ i ] ] = m . get ( arr [ i ] , 0 ) + 1 NEW_LINE ans = max ( ans , m [ arr [ i ] ] ) NEW_LINE DEDENT print ( " Minimum ▁ number ▁ of " , " Visible ▁ Bottles ▁ are : ▁ " , ans ) NEW_LINE DEDENT n = 8 NEW_LINE arr = [ 1 , 1 , 2 , 3 , 4 , 5 , 5 , 4 ] NEW_LINE min_visible_bottles ( arr , n ) NEW_LINE