Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    1353 - Maximum Number of Events That Can Be Attended.

    Medium

    You are given an array of events where <code>eventsi = startDay<sub>i</sub>, endDay<sub>i</sub></code>. Every event i starts at <code>startDay<sub>i</sub></code> and ends at <code>endDay<sub>i</sub></code>.

    You can attend an event i at any day d where <code>startTime<sub>i</sub><= d <= endTime<sub>i</sub></code>. You can only attend one event at any time d.

    Return the maximum number of events you can attend.

    Example 1:

    Input: events = [1,2,2,3,3,4]

    Output: 3

    Explanation: You can attend all the three events.

    One way to attend them all is as shown.

    Attend the first event on day 1.

    Attend the second event on day 2.

    Attend the third event on day 3.

    Example 2:

    Input: events= [1,2,2,3,3,4,1,2]

    Output: 4

    Constraints:

    • <code>1 <= events.length <= 10<sup>5</sup></code>

    • events[i].length == 2

    • <code>1 <= startDay<sub>i</sub><= endDay<sub>i</sub><= 10<sup>5</sup></code>

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Integer maxEvents(Array<IntArray> events)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait