summaryrefslogtreecommitdiff
path: root/2020/11/30/README.md
blob: d6465dd4cb28995eef1ff3a46260531fec9ed9f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Given a list of building in the form of (left, right, height), return
what the skyline should look like. The skyline should be in the form of
a list of (x-axis, height), where x-axis is the next point where there
is a change in height starting from 0, and height is the new height
starting from the x-axis.

Here's some starter code:

```ruby
def generate_skyline(buildings):
# Fill this in.
#            2 2 2
#            2 2 2
#        1 1 2 2 2 1 1
#        1 1 2 2 2 1 1
#        1 1 2 2 2 1 1
# pos: 1 2 3 4 5 6 7 8 9
print generate_skyline([(2, 8, 3), (4, 6, 5)])
# [(2, 3), (4, 5), (7, 3), (9, 0)]
```