Class Solution
java.lang.Object
g1301_1400.s1353_maximum_number_of_events_that_can_be_attended.Solution
1353 - Maximum Number of Events That Can Be Attended.<p>Medium</p>
<p>You are given an array of <code>events</code> where <code>events[i] = [startDay<sub>i</sub>, endDay<sub>i</sub>]</code>. Every event <code>i</code> starts at <code>startDay<sub>i</sub></code> and ends at <code>endDay<sub>i</sub></code>.</p>
<p>You can attend an event <code>i</code> at any day <code>d</code> where <code>startTime<sub>i</sub> <= d <= endTime<sub>i</sub></code>. You can only attend one event at any time <code>d</code>.</p>
<p>Return <em>the maximum number of events you can attend</em>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/02/05/e1.png" alt="" /></p>
<p><strong>Input:</strong> events = [[1,2],[2,3],[3,4]]</p>
<p><strong>Output:</strong> 3</p>
<p><strong>Explanation:</strong> You can attend all the three events.</p>
<p>One way to attend them all is as shown.</p>
<p>Attend the first event on day 1.</p>
<p>Attend the second event on day 2.</p>
<p>Attend the third event on day 3.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> events= [[1,2],[2,3],[3,4],[1,2]]</p>
<p><strong>Output:</strong> 4</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= events.length <= 10<sup>5</sup></code></li>
<li><code>events[i].length == 2</code></li>
<li><code>1 <= startDay<sub>i</sub> <= endDay<sub>i</sub> <= 10<sup>5</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
maxEvents
public int maxEvents(int[][] events)
-