FastPrepMaximum Number of Events That Can Be Attended
Problems/Maximum Number of Events That Can Be Attended

Maximum Number of Events That Can Be Attended

Snowflake logoSnowflake● MediumFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report identifies this as a standard event-attendance maximization task. The judged task matches that referenced problem at about 99%.

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[][]) → int

Examples

Example 1

events = [[1,2],[2,3],[3,4]]return = 3

Attend the three events on days 1, 2, and 3, respectively.

Example 2

events = [[1,2],[2,3],[3,4],[1,2]]return = 4

Attend 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^5
  • events[i].length == 2
  • 1 <= startDay_i <= endDay_i <= 10^5

More Snowflake problems

  • Connect Four from the Last MovePHONE SCREEN · Seen Nov 2026
  • Configurable Per-Client Token BucketsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Find Valid SET Card TriplesOA · PHONE SCREEN · Seen Nov 2026
All Snowflake interview questionsSee Snowflake hiring insights
Saved
class Solution {
    public int maxEvents(int[][] events) {
        // Write your code here
    }
}
Checking account…