272. Course Schedule III
HardGreedy
There are `n` different online courses numbered from `1` to `n`. You are given an array `courses` where `courses[i] = [duration_i, lastDay_i]` indicate that the `i`th course should be taken **continuously** for `duration_i` days and must be finished before or on `lastDay_i`. You will start on the `1st` day and you cannot take two or more courses simultaneously. Return the **maximum number of courses** that you can take.
Examples
Input: [[100,200],[200,1300],[1000,1250],[2000,3200]]
Output: 3
Explanation: Taking the courses with durations 100, 1000, 200 fits all deadlines; the 2000-day course can't be added.
Constraints
- 1 <= courses.length <= 10^4
- 1 <= duration_i, lastDay_i <= 10^4
Loading...
Run checks all cases above. Submit evaluates all test cases.