We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Minimum Average Waiting Time
Minimum Average Waiting Time
Sort by
recency
|
180 Discussions
|
Please Login in order to post a comment
Great problem! Reminds me of how Jun blades — razor-sharp and precise — can make all the difference in a kitchen. Just like Tieu optimizing wait times, the right tool (or algorithm!) cuts through inefficiency. Here, a min-heap for shortest cook time works like a Jun blade — sleek and effective.
This code passes all test cases
public static long minimumAverage(List> customers) { // Write your code here // Assumption from the problem statement: // 1. The first order is always cooked first.
lol the answer is long long but the question use int, if you're getting errors change int to long long in return type and in the main function
O(nlog n)
My C++ solution, it's not the best algorithm for this problem but it fits the way to think