Company: Agoda_9nov
Difficulty: medium
Choose Flask Problem Description You are given a list of requirements for orders, a number of flask types, and a 2D array of markings for each flask type. Your goal is to choose a flask type that minimizes the total waste when fulfilling all requirements. If multiple flask types result in the same minimum waste, choose the one with the smallest index. NOTE: The markings 2D array will be given in order of the flasks, i.e., the markings for the 0-index flask will be followed by markings of 1-index flask and so on. For each flask, the marks are sorted in ascending order. Complete the function chooseFlask in the editor with the following parameter(s): int requirements[n] : the requirements for the orders int flaskTypes : the number of flask types int markings[totalMarks][2] : the first column signifies the index of the flask, and the second signifies a mark Returns: int : the index of the flask to choose, or -1 if none will work. Examples Example 1: Input: requirements = [4, 6] flaskTypes