Solution: Organizing a Lottery
Solutions for the Points and Segments Problem.
We'll cover the following...
Solution 1: Sorting all points
Consider an example with segments and points :
Let’s initialize to and scan the line above from the left to the right. We will increase (or decrease) by each time we encounter a left (or right) endpoint of an interval. Initially, ...