The solution is simpler than mine.
For res[-1][1] = max(res[-1][1], interval[1]), we only need to update the right edge, because the interval[0] is always > res[-1][0]. Cool!
The solution is simpler than mine.
For res[-1][1] = max(res[-1][1], interval[1]), we only need to update the right edge, because the interval[0] is always > res[-1][0]. Cool!