Company: OpenText_9oct
Difficulty: medium
Maximize Gift Packets Problem Description Cathy delivers gift packets. Every packet is identical and holds items of N different types in a fixed ratio: one packet contains exactly ratio[i] units of item type i , for every i from 1 to N . A packet must contain all N types of items, so a packet can only be assembled while every type still has enough stock left. Cathy has available[i] units of item type i in stock. To maximize her profit she prepares as many complete packets as the stock allows. Units that cannot complete one more packet are left over and are not used. Find the total number of units (summed over all item types) that Cathy uses to prepare the maximum number of packets. Because this total can be large, return it modulo 1000000007 . Function Description Complete the function maximizePackets in the editor. It has the following parameters: int N : the number of item types long ratio[N] : ratio[i] is the number of units of type i in one packet long available[N] : available[i] i