Gamified challenge · Greedy by profit
Each job is [deadline, profit]. Every job takes exactly one day, the workshop does one job per day starting on day 1, and a job pays its profit only if it is done on a day <= deadline. Jobs you skip pay nothing.
Write maxProfit(jobs) that returns the largest total profit. For [[1, 10], [2, 20], [2, 30]] the answer is 50: do the 20 job on day 1 and the 30 job on day 2.
This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.
Sign in with Google