# Skyscrapers

Every row and column in the diagram contains skyscrapers of different heights, exactly those heights indicated at the side of the puzzle (so sometimes some places remain empty, when for example heights 1~4 are used in a 6x6 puzzle). No two skyscrapers of the same height are in the same row or column. The numbers around the diagram denote how many skyscrapers are visible from that direction: higher skyscrapers block lower ones. If a number can see the grid in different directions (for example both to the left and up), then that number of skyscrapers is visible in all these directions.

## Example

In this example, we need to fill in skyscrapers of heights 1 to 4. In the top right there is a 4 next to the diagram, which means that all scrapers in the top row are visible from the right. This is only possible if they have decreasing heights from left to right, so the top row reads 4-3-2-1. In the bottom right, there is a 1 next to the diagram. This means only one scraper is visible from the right, so this must be the highest one: the 4.

In the bottom column, there needs to be a scraper of height 3. It cannot be in the leftmost column, since in that column three scrapers need to be visible from below, and a 3 would block both the 1 and the 2. It also cannot be in the second column, since there already is a 3 in that column. So it must be in the third column. To complete the bottom row, look at the 3 to the left of it: if the 1 would be in the first column and the 2 in the second, then all four scrapers would be visible from the left, so it must be the other way around.

In the second row, five scrapers are visible in total from both left and right. Since the highest one is the only that can be seen from two sides, all other scrapers must be visible. This means that the 4 must be in the third position. The 3 cannot be in the first position because it would block the second position from view, it cannot be in the second position because there already is a 3 in that column, so it must be in the third position. The 1 and the 2 must both be visible from the left, so the 1 comes first. To complete the puzzle, we just need to fill in the missing number in every column.

Puzzles in this genre.
 Info