码迷,mamicode.com
首页 > 其他好文 > 详细

131. The Skyline Problem

时间:2019-01-20 11:49:45      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:info   can   example   from   ted   where   diff   and   height   

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

标签:info   can   example   from   ted   where   diff   and   height   

原文地址:https://www.cnblogs.com/lawrenceSeattle/p/10294103.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!