Maximum Number of Events That Can Be Attended II
Examples
Example 1:
Input: events = [[1,2,4],[3,4,3],[2,3,1]], k = 2
Output: 7
Example 2:
Input: events = [[1,2,4],[3,4,3],[2,3,10]], k = 2
Output: 10
Example 1:
Input: events = [[1,2,4],[3,4,3],[2,3,1]], k = 2
Output: 7
Example 2:
Input: events = [[1,2,4],[3,4,3],[2,3,10]], k = 2
Output: 10
You are given an array of events where events[i] = [startDay_i, endDay_i, value_i]. Event i starts at startDay_i and ends at endDay_i, and if you attend it you earn value_i.
You can attend at most k events. You cannot attend two events that overlap in time. If one event ends on day d, the next attended event must start on a day strictly greater than d.
Return the maximum total value you can earn by attending at most k events.
1 <= k <= events.length1 <= events.length <= 10^51 <= startDay_i <= endDay_i <= 10^91 <= value_i <= 10^6