java.lang.Object
g2401_2500.s2446_determine_if_two_events_have_conflict.Solution

public class Solution extends Object
2446 - Determine if Two Events Have Conflict.<p>Easy</p> <p>You are given two arrays of strings that represent two inclusive events that happened <strong>on the same day</strong> , <code>event1</code> and <code>event2</code>, where:</p> <ul> <li><code>event1 = [startTime<sub>1</sub>, endTime<sub>1</sub>]</code> and</li> <li><code>event2 = [startTime<sub>2</sub>, endTime<sub>2</sub>]</code>.</li> </ul> <p>Event times are valid 24 hours format in the form of <code>HH:MM</code>.</p> <p>A <strong>conflict</strong> happens when two events have some non-empty intersection (i.e., some moment is common to both events).</p> <p>Return <code>true</code> <em>if there is a conflict between two events. Otherwise, return</em> <code>false</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> event1 = [&ldquo;01:15&rdquo;,&ldquo;02:00&rdquo;], event2 = [&ldquo;02:00&rdquo;,&ldquo;03:00&rdquo;]</p> <p><strong>Output:</strong> true</p> <p><strong>Explanation:</strong> The two events intersect at time 2:00.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> event1 = [&ldquo;01:00&rdquo;,&ldquo;02:00&rdquo;], event2 = [&ldquo;01:20&rdquo;,&ldquo;03:00&rdquo;]</p> <p><strong>Output:</strong> true</p> <p><strong>Explanation:</strong> The two events intersect starting from 01:20 to 02:00.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> event1 = [&ldquo;10:00&rdquo;,&ldquo;11:00&rdquo;], event2 = [&ldquo;14:00&rdquo;,&ldquo;15:00&rdquo;]</p> <p><strong>Output:</strong> false</p> <p><strong>Explanation:</strong> The two events do not intersect.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>evnet1.length == event2.length == 2.</code></li> <li><code>event1[i].length == event2[i].length == 5</code></li> <li><code>startTime<sub>1</sub> <= endTime<sub>1</sub></code></li> <li><code>startTime<sub>2</sub> <= endTime<sub>2</sub></code></li> <li>All the event times follow the <code>HH:MM</code> format.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • haveConflict

      public boolean haveConflict(String[] event1, String[] event2)