Company: Twilio
Difficulty: medium
Question 2 Twilio plans on gifting their clients a golden owl that needs to be manufactured. However, careful planning must take place before production begins. For each product there is a worst-case cost and an expected cost. Before starting a project, Twilio must have at least enough cash on hand to pay the worst-case cost for each product. If every product is produced at expected cost, determine the minimum beginning cash requirement to get all products produced. The owls can be produced in any order. Function Description Complete the function planProduction in the editor below. The function must return an integer. planProduction has the following parameter(s): worstCase[worstCase[0]...worstCase[n-1]] : an array of n integers representing the minimum cash-on-hand to produce the i th product. expected[expected[0]...expected[n-1]] : an array of n integers, representing the expected cost to produce the i th product. Constraints 1 ≤ n ≤ 10 5 1 ≤ worstCase[i] ≤ 10 5 1 ≤ expected[i] ≤ 10