Calculate minimum cost
if ( i == n ) { min_cost = Math . min ( min_cost , curr_cost ) ; common_ratio = j ; } } System . out . print ( min_cost + " ▁ " ) ; System . out . print ( common_ratio + " ▁ " ) ; }