Company: Agoda_9nov
Difficulty: medium
Choose Flask Problem Description A laboratory must fill n orders. Order i needs exactly requirements[i] units of liquid. There are flaskTypes kinds of flask to choose from, and a flask kind is described by the marks printed on its side. To fill an order of size r with a flask you must pour up to the **smallest mark that is at least r **, and the liquid above the order's level is wasted: mark - r units. A flask kind whose largest mark is below some order cannot serve that order at all, and is unusable. You must pick one flask kind and use it for every order. Return the index of the kind with the smallest total waste . If several tie, return the smallest index . If no kind can serve every order, return -1 . The markings are given as [flaskIndex, mark] pairs, grouped by flask and, within a flask, in ascending order of mark. Notes: Two orders of the same size are both served, and both waste liquid. A flask kind may have no marks listed at all, in which case it can serve nothing. The total