arya2004 / leetcode-daily-october-hacktoberfest-2024

Leetcode Daily October Hacktoberfest 2024
MIT License
10 stars 49 forks source link

Add Day 12 solution in Python #71

Closed gnjayasekara closed 1 month ago

gnjayasekara commented 1 month ago

🚀 What does this PR do?

📝 Issue Reference:

Fixes issue: #12

🔍 Checklist:

Please ensure the following before submitting your PR:

🔧 Solution Details:

🌟 Additional Notes (if any):

Alternative approach

  1. Sort the intervals by their start times to analyze when overlaps happen.
  2. Track how many intervals overlap at any point:
    • Use the idea of "event points": Mark when each interval starts and ends.
    • Increase the count when an interval starts and decrease it when it ends.
  3. Determine the maximum overlap at any point: The maximum number of overlapping intervals at the same time tells you the minimum number of groups needed.