Trains the technique from
LeetCode 1235Maximum Profit in Job SchedulingThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A recording studio has a stack of booking requests to answer. Request i wants the room from hour start[i] until hour finish[i] and pays payout[i] if it is accepted.
The room holds one session at a time, so two accepted requests may not overlap. Requests that merely touch are fine: a request that ends at hour t can be followed by one that begins at hour t, because the engineer resets the room instantly.
Accept any collection of requests you like, subject to that rule, and return the largest total payout obtainable. Accepting nothing is allowed but never necessary, since every payout is positive.
Example 1
The second request begins on the hour the first one ends, so both fit and the studio collects everything.
Example 2
Two shorter back-to-back sessions beat the single long one that pays 20 and blocks the whole day.
Example 3
Every pair of requests overlaps here, so only the best paying one can be taken.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def max_payout(start: list[int], finish: list[int], payout: list[int]) -> int:public int maxPayout(int[] start, int[] finish, int[] payout)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.