Trains the technique from
LeetCode 218The Skyline ProblemThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
Blocks stand in a row along a line. Each entry of buildings is [left, right, height] for one block, standing on the ground between those two positions with that height. The list is given in non-decreasing order of left.
The outline is the shape of the row seen from a distance. Return it as a list of [position, height] turning points, in increasing order of position: each turning point marks a position where the outline's height changes, giving the new height. The height after the last block is 0, so the final turning point always has height 0. No two turning points share a position, and no two neighbouring turning points have the same height.
Example 1
The outline rises to 14 at position 3, to 27 at 5 where the taller block starts, drops to 6 at 12 where that block ends, falls to nothing at 18, and then rises to 31 at 20 before ending at 24.
Example 2
The two blocks are the same height and meet exactly, so the outline shows one step up and one step down with no turning point in the middle.
Example 3
A single block gives one step up and one step back down to nothing.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def get_skyline(buildings: list[list[int]]) -> list[list[int]]:public List<List<Integer>> getSkyline(int[][] buildings)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.