Maximum cake orders
A bakery takes custom cake orders for tomorrow. Every cake takes exactly one hour, work starts at hour 0, and only one cake is in the oven at a time. deadlines[i] is the hour by which order i must be finished — a deadline of 3 means it must be done at or before hour 3. Orders may be declined. Return the maximum number of orders the bakery can fulfill. Example: deadlines [2, 1, 2] gives 2.
Implement
max_orders(deadlines: list[int]) → intExamples
in
[[2,1,2]]out2What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 14 min
solution.py
InputExpectedGot
[[2,1,2]]2not run yetsample