Company: Cashfree_11dec
Difficulty: medium
Choose a Flask Choose a Flask Problem Description A robotic chemical delivery system in a college laboratory uses only one type of glass flask per day. Each chemical order must be filled to a mark that is at least equal to the volume ordered. There are multiple flask types available, each with marks at various levels. 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. NOTE: For each flask, the marks are sorted in ascending order. Example requirements = [4, 6, 6, 7] flaskTypes = 3 markings = [ [3, 5, 7], // Flask 0 [6, 8, 9], // Flask 1 [3, 5, 6] // Flask 2 ] Returns: 0 Analysis: The requirements are 4, 6, 6, and 7. Using fl