Solved LeetCode program · 599 of 1,000
#0826 · Most Profit Assigning Work
Original English source
Keep a shared difficulty holding 2, 4, 6, 8, and 10. Keep a shared profit holding 10, 20, 30, 40, and 50. The workers is a list of 4, 5, 6, and 7. Keep a shared best of 0.
To score from ability (a whole number). Set best to 0.
For every job from 0 to the last position of difficulty.
If item job of difficulty is at most ability and item job of profit is more than best, set best to item job of profit.
The total is 0.
For each worker in workers.
Score from worker. Add best to total.
Show total.
Expected stdout
100