Problem Statement | |||||||||||||
There are several skyscrapers arranged in a row. You're interested in finding the one from which the maximal number of other skyscrapers can be seen. The i-th skyscraper can be represented as a line segment on a plane with endpoints (i, 0) and (i, heights[i]). A skyscraper can be seen from the roof of another skyscraper if a line segment connecting their roofs does not intersect with or touch any other skyscraper. Return the maximal number of other skyscrapers that can be seen from the roof of some skyscraper. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | heights will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of heights will be between 1 and 1,000,000,000, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
| |||||||||||||
5) | |||||||||||||
|