Haskell Skyline
Recently I started learning Haskell by studying the Intro to FP Programming course on Edx. Since then, I try to model different problems using Haskell.
One of these problems is the Skyline problem, which goes like this:
You are given a set of rectangular buildings in a city, and you should return the skyline view of the city. Input is a sequence of tuples
(x_{left}, height, x_{right})
, each describing a building. The output is a sequence of pairs(x, height)
meaning that the height of skyline changed toheight
at the given x coordinate.