Maximum nesting depth
Your task
A document viewer renders highlight spans as nested markup, so one span may sit wholly inside another but two spans may never partially overlap. starts and ends are parallel lists: span i marks the characters from starts[i] up to but not including ends[i], and no span ends before it starts. The spans arrive in no particular order. A span whose end equals its start marks nothing and is ignored. Two spans that touch at one boundary, where one ends exactly where the next begins, do not overlap. Two spans with identical bounds count as one sitting inside the other. Return the deepest nesting the viewer would have to render, counting a top level span as depth 1, or return -1 when some pair of spans partially overlaps so no nesting is possible. Return 0 when nothing is marked.
Examples
span_nesting_depth(starts: list[int], ends: list[int]) -> intspan_nesting_depth([0, 1, 2], [9, 8, 3])3span_nesting_depth([0, 3], [5, 8])-1span_nesting_depth([0, 5], [5, 10])1