Company: Infoedge_26april
Difficulty: medium
Delicious Food Cooking Problem Description You're assisting your mother in cooking a delicious meal. However, the gas stove only has 2 burners, limiting you to cook a maximum of 2 items simultaneously. You're provided with an integer array arr of length n , where arr[i] represents the time required to cook the i-th dish. Your objective is to determine the minimum time needed to prepare all the dishes. Complete the function minTimeToCook(arr) , which returns the minimum time (in seconds) after which every dish has been cooked. Rules of the stove: Both burners are free at time t = 0 . Each dish is cooked on exactly one burner, in one uninterrupted stretch of arr[i] seconds. (inferred - the source never says a dish may be moved between burners or paused part-way; its worked example cooks every dish in one piece on one burner, so a dish can never be split.) A burner cooks at most one dish at a time. As soon as a burner becomes free, the next dish may be placed on it with no delay, and the