Minimum class cancellations

Write codeMedium15 min

Your task

A yoga studio received proposed class slots for its single room as [start, end] pairs, each occupying the half-open span [start, end), unsorted, possibly overlapping. The studio will cancel some proposals so that the surviving classes never overlap (back-to-back is fine). Return the minimum number of proposals it must cancel. Example: [[9,11],[10,12],[11,13]] requires 1 cancellation.

Examples

min_cancellations(proposals: list[list[int]]) -> int
Example 1
Inputmin_cancellations([[9, 11], [10, 12], [11, 13]])
Output1