Practice Maximum Number of Events That Can Be Attended II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Maximum Number of Events That Can Be Attended II
Problem Statement
You are given an array of events where events[i] = [startDayi, endDayi, valuei]. The ith event starts at startDayi and ends at endDayi, and if you attend this event, you will receive a value of valuei. You are also given an integer k which represents the maximum number of events you can attend. You can only attend one event at a time. If you choose to attend an event, you must attend the entire event. Note that the end day is inclusive: that is, you cannot attend two events where one of them starts and the other ends on the same day. Return the maximum sum of values that you can receive by attending events.
Source: Maximum Number of Events That Can Be Attended II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
events = [[1,2,4],[3,4,3],[2,3,1]], k = 2
7
# Example 2
events = [[1,2,4],[3,4,3],[2,3,10]], k = 2
10
# Example 3
events = [[1,1,1],[2,2,2],[3,3,3],[4,4,4]], k = 3
9
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Number of Events That Can Be Attended II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.