Tried a different approach here:
Assign a building ID to every building.
Store building heights in an array with index as the building ID.
Store the heights in the skyline array.
Store the list of building IDs at every index. That gives us: at an index, we know the height and the list of buildings that occur at the index.
given 2 indices, check if there are common buildings between them, if so, the skyline does not go to 0.
Problem with this approach is that it becomes difficult to trace building intersesctions.