a citys skyline outer contour silhouette form building city view distance give location height building return skyline form building collectivelyThe geometric information building give array building buildingsi lefti righti heightilefti x coordinate leave edge ith buildingrighti x coordinate right edge ith buildingheighti height ith buildingyou assume building perfect rectangle ground absolutely flat surface height 0the skyline represent list key point sort xcoordinate form x1y1x2y2 each key point leave endpoint horizontal segment skyline point list ycoordinate 0 mark skylines termination rightmost building end any ground leftmost rightmost building skyline contournote there consecutive horizontal line equal height output skyline for instance 2 34 57 511 512 7 acceptable line height 5 merge final output 2 34 512 7 Example 1input building 291037155121215201019248output 2103157121201510208240explanationfigure a show building inputfigure b show skyline form building the red point figure B represent key point output listExample 2input building 023253output 0350 constraints1 buildingslength 1040 lefti righti 231 11 heighti 231 1buildings sorted lefti nondecrease order