Problem · Array
Maximum Number of Events That Can Be Attended
Learn this problemProblem statement
You are given an array events, where events[i] = [startDay_i, endDay_i]. Event i can be attended on any one day from startDay_i through endDay_i, inclusive.
You may attend at most one event on any day. Return the maximum number of events you can attend.
Function
maxEvents(events: int[][]) → intExamples
Example 1
events = [[1,2],[2,3],[3,4]]return = 3Attend the three events on days 1, 2, and 3, respectively.
Example 2
events = [[1,2],[2,3],[3,4],[1,2]]return = 4Attend the two events ending on day 2 on days 1 and 2, then attend the remaining events on days 3 and 4.
Constraints
1 <= events.length <= 10^5events[i].length == 21 <= startDay_i <= endDay_i <= 10^5
More Snowflake problems
- Distributed Tree Counting State MachinePHONE SCREEN · Seen Jul 2026
- Minimum N-ary Tree Depth DeletionsPHONE SCREEN · Seen Jul 2026
- Simulate a Queued Multi-Rule Rate LimiterPHONE SCREEN · Seen Jul 2026
- Minimum Clicks Between Wiki PagesOA · Seen Jul 2026
- Closest Target CharacterPHONE SCREEN · Seen Jul 2026
- Horizontal Pod AutoscalerOA · Seen Jul 2026
- Minimum HeightOA · Seen Jul 2026
- Vowel SubstringOA · Seen Jun 2026