|You are watching a car race. Each car starts a different point on the x-axis, travels at the same speed, and starts at the same time. However, each car is travelling along a different road (which extends to infinity in one direction, and is stopped by the x-axis in the other direction), and each road has its own direction specified by an angle between 1 and 179, inclusive. An angle of 90 indicates that the road heads directly in the positive y direction, while an angle of 1 indicates that the road heads just a little bit north of the positive x direction. Note that cars never head in the negative y direction.|
Sometimes, two or more roads intersect at some point. When this happens, the car that reaches the intersection first is able to block the intersection so that no other cars can pass through it. If two cars reach an intersection at the same time, the one with the lower index passes, while the other one is blocked.
In this picture, the cars following the red paths make it through all of the intersections, while the cars on the gray paths are blocked.
You will be given a int angles, where the ith element of angles is the angle between the x-axis and the road that the ith car drives on, in degrees. The order of the elements of angles corresponds to the order of the cars along the x-axis (no two cars start at the exact same location), with the first element of angles corresponding to the car with the leftmost starting position on the x-axis.
Your method should return a int containing the 0-based indices of all the cars that will pass all of the intersections along their roads. Your return should be sorted in ascending order.
Note that the exact locations of the cars along the x-axis do not matter. All that matters is their order, and the directions in which they head.
|-||angles will contain between 1 and 50 elements, inclusive.|
|-||Each elemtent of angles will be between 1 and 179, inclusive.|