2446. Determine if Two Events Have Conflict LeetCode Solution
In this guide, you will get 2446. Determine if Two Events Have Conflict LeetCode Solution with the best time and space complexity. The solution to Determine if Two Events Have Conflict problem is provided in various programming languages like C++, Java, and Python. This will be helpful for you if you are preparing for placements, hackathons, interviews, or practice purposes. The solutions provided here are very easy to follow and include detailed explanations.
Table of Contents
- Problem Statement
- Complexity Analysis
- Determine if Two Events Have Conflict solution in C++
- Determine if Two Events Have Conflict solution in Java
- Determine if Two Events Have Conflict solution in Python
- Additional Resources

Problem Statement of Determine if Two Events Have Conflict
You are given two arrays of strings that represent two inclusive events that happened on the same day, event1 and event2, where:
event1 = [startTime1, endTime1] and
event2 = [startTime2, endTime2].
Event times are valid 24 hours format in the form of HH:MM.
A conflict happens when two events have some non-empty intersection (i.e., some moment is common to both events).
Return true if there is a conflict between two events. Otherwise, return false.
Example 1:
Input: event1 = [“01:15″,”02:00”], event2 = [“02:00″,”03:00”]
Output: true
Explanation: The two events intersect at time 2:00.
Example 2:
Input: event1 = [“01:00″,”02:00”], event2 = [“01:20″,”03:00”]
Output: true
Explanation: The two events intersect starting from 01:20 to 02:00.
Example 3:
Input: event1 = [“10:00″,”11:00”], event2 = [“14:00″,”15:00”]
Output: false
Explanation: The two events do not intersect.
Constraints:
event1.length == event2.length == 2
event1[i].length == event2[i].length == 5
startTime1 <= endTime1
startTime2 <= endTime2
All the event times follow the HH:MM format.
Complexity Analysis
- Time Complexity: O(1)
- Space Complexity: O(1)
2446. Determine if Two Events Have Conflict LeetCode Solution in C++
class Solution {
public:
bool haveConflict(vector<string>& event1, vector<string>& event2) {
return event1[0] <= event2[1] && event2[0] <= event1[1];
}
};
/* code provided by PROGIEZ */
2446. Determine if Two Events Have Conflict LeetCode Solution in Java
class Solution {
public boolean haveConflict(String[] event1, String[] event2) {
return event1[0].compareTo(event2[1]) <= 0 && event2[0].compareTo(event1[1]) <= 0;
}
}
// code provided by PROGIEZ
2446. Determine if Two Events Have Conflict LeetCode Solution in Python
# code by PROGIEZ
Additional Resources
- Explore all LeetCode problem solutions at Progiez here
- Explore all problems on LeetCode website here
Happy Coding! Keep following PROGIEZ for more updates and solutions.