Solving the 'skyline' problem from https://briangordon.github.io/2014/08/the-skyline-problem.html