Approach hintTry it first, then revealHide
Sort jobs by end time. The best profit over the first i jobs either skips job i or takes it plus the best result among jobs ending no later than its start, found by binary search. O(n log n).
Sort jobs by end time. The best profit over the first i jobs either skips job i or takes it plus the best result among jobs ending no later than its start, found by binary search. O(n log n).