← Questions

Most optional tasks under a daily time limit

0
AmazonCodingLast asked Sep 2025

Each day has the same time limit. Every day must run its required task; if time allows, it can also run one optional task. You get n required durations (one per day) and n optional durations that can go on any day. Return the most optional tasks you can schedule without any day going over the limit. For example, with limit 7, required [4, 5, 2, 4] and optional [5, 6, 3, 4], two optional tasks fit.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding