131. The Skyline Problem
Posted lawrenceseattle
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了131. The Skyline Problem相关的知识,希望对你有一定的参考价值。
Given N buildings in a x-axis,each building is a rectangle and can be represented by a triple (start, end, height),where start is the start position on x-axis, end is the end position on x-axis and height is the height of the building. Buildings may overlap if you see them from far away,find the outline of them。
An outline can be represented by a triple, (start, end, height), where start is the start position on x-axis of the outline, end is the end position on x-axis and height is the height of the outline.
Building Outline
Example
Given 3 buildings:
[
[1, 3, 3],
[2, 4, 4],
[5, 6, 1]
]
The outlines are:
[
[1, 2, 3],
[2, 4, 4],
[5, 6, 1]
]
Notice
Please merge the adjacent outlines if they have the same height and make sure different outlines cant overlap on x-axis.
```
以上是关于131. The Skyline Problem的主要内容,如果未能解决你的问题,请参考以下文章