A robotic chemical delivery system in a college laboratory uses only one type of glass flask per day. Each chemical order must be filled with a mark that is at least equal to the volume ordered. There are multiple flask types available, such as with various marks and various loads.
Given a list of order requirements and a list of flasks with their measurements, determine which single type of flask will result in minimal waste. Waste is calculated as the sum of (marking - requirement) for each order.
Return the zero-based index of the chosen flask type. If multiple flask types have the same minimal waste, return the one with the lowest index. If no flask can satisfy all requirements, return -1.
Expert in Data Structures & Algorithms. Building tools to help developers crack FAANG interviews.