There is a question in Elements of Programming Interviews that I have tried to solve but was unsuccessful.
Assume we are given an array of intervals of the form (d1, d2) where d1 and d2 are values in degrees representing the start and end angles of an arc, where 0 degrees is the y-axis. These intervals can overlap, and you can have an interval like (350, 10). What is the minimum number of rays you can shoot to intersect all the intervals? A ray can be represented as an angle in degrees from the y-axis.
I've tried sorting by endpoints and seeing if each endpoint intersects wit hthe next interval, but I couldn't figure out how to deal with the overlapping intervals such as (340, 350), (350, 20).

to optimize the number of arcs, you CAN'T throw a ray from A to B and another ray from C to D if A and C intersect, for example.
the keypoint is to find all the intersection points between arcs (and sort them by the points that belong to more arcs).
After you sort them, get the angle that belong to more arcs and set a ray from it to another point that belong to some other set of arcs different from the first. The most different, the better. You can just travel the angles and check for the one that fits the best.