Minimum points covering intervals

Write codeHard40 min

Your task

Given a set of closed integer intervals, find the size of the SMALLEST set S of integers such that every interval contains at least TWO distinct elements of S. Return that minimum size.

Examples

intersection_size_two(intervals: list[list[int]]) -> int
Example 1
Inputintersection_size_two([[1, 3], [3, 7], [8, 9]])
Output5