def interval_partitioning(events):
    """
    Created a sorted collection of `Event(t)`, where an event can be arrival or
    departure, sorted based on the time.
    Then starting from the beginning, keep a count of `#arrival - #departure`.
    The max value ever encountered of `#arrival - #departure` is the answer.
    """
    # CAREFUL: I was thinking of heap, but this solution is so much better than that.
    events_sorted = []
    for event in events:
        events_sorted.append((event[0], True))
        events_sorted.append((event[1], False))
    events_sorted.sort()
    answer = 0
    num_resources_required_right_now = 0
    for event in events_sorted:
        if event[1]:
            num_resources_required_right_now += 1
        else:
            num_resources_required_right_now -= 1
        answer = max(answer, num_resources_required_right_now)
    return answer