Minimum Interval to Include Each Query - Leetcode 1851 - Python