# Skyscrapers решение

Skyscrapers is a building placing puzzle based on an NxN grid with some clues along its sides. The object is to place a skyscraper in each square, with a height between 1 and N, so that no two skyscrapers in a row or column have the same number of floors. In addition, the number of visible skyscrapers, as viewed from the direction of each clue, is equal to the value of the clue. Note that higher skyscrapers block the view of lower skyscrapers located behind them. In the example below we have a 5x5 Skyscrapers puzzle with five columns and five rows. We now need to place 1-floor to 5-floor skyscrapers in each row and column according to the above rules… but how?

## Starting techniques

Skyscrapers puzzles frequently contain the clue 1 and/or clue N which are very easy to start off with. Clue 1 means only the highest skyscraper in the row or column is visible and clue N means all skyscrapers in the row or column are visible:

#### 1. Clues of 1

Clue 1 means only one skyscraper is visible when viewing the row or column from the direction of the clue. Therefore in the example below, the highest skyscraper with 5 floors must be placed next to the clue 1 to block the view of the remaining buildings.

#### 2. Clues of N

Clue N, in an NxN grid, means all skyscrapers are visible when viewing the row or column from the direction of the clue. Therefore in the example below, the five skyscrapers must be placed in ascending order from the clue 5 so no building gets blocked.

## Basic techniques

We now continue with the basic techniques, where it is usually straightforward to analyze and deduct where the next skyscraper should be placed. Here are some ways of using the basic techniques:

#### 1. High skyscrapers (technique 1)

The next step after starting techniques is usually placing one or more of the highest skyscrapers. Let’s look at the center column of the partially solved puzzle below. According to the rules, 4 skyscrapers should be visible when looking from the direction of clue 4 on the bottom which means a 5-floor skyscraper can only be placed in one of the two top squares. However, since the top row already contains a 5-floor skyscraper, the only square in the center column in which such skyscraper can be placed is the second from the top.

#### 2. High skyscrapers (technique 2)

Sometimes the information of two or more clues is necessary to determine where to place the next skyscraper. Let’s look where a 4-floor skyscraper can be placed in the top row of the partially solved puzzle below. This is not possible in the left square since the clue 3 on the left requires that three skyscrapers are visible from the left of the top row. Similarly, this is not possible in the right square since the clue 4 on the top requires that four skyscrapers are visible from the top of the right column. Since the second column from the left already contains a 4-floor skyscraper, the only square in the top row where such skyscraper can be placed is in the center.

#### 3. Unique skyscraper sequences

There are sometimes situations where only one sequence of remaining skyscrapers can be placed in the empty squares of a row or column. The far right column of the partially solved puzzle below is missing skyscrapers with 2, 3, 4 and 5 floors. Whichever way we try to place these four skyscrapers, we will find that clue 4 leaves us with only one possible sequence as shown in the right-hand image below.

#### 4. No skyscraper may repeat in a row or column

In many cases, especially after several steps in a puzzle have been completed, it is possible to progress using the second rule of Skyscrapers where no two skyscrapers in a row or column can have the same number of floors. Using this rule, we can see that a 4-floor and a 5-floor skyscraper can be placed in the second and fourth rows respectively as shown below. After this, a 4-floor skyscraper can be placed in the third row using the same rule.

#### 5. Highest skyscraper located far-opposite clue 2

Whenever the highest skyscraper is at the far opposite side of clue 2, the second highest skyscraper must be placed next to clue 2. In the example below, a 4-floor skyscraper which is the second highest in a 5x5 grid must be placed next to clue 2 in the top square of the left column. Any other skyscraper would cause more than two buildings to be visible when viewing the left column from the direction of this clue.

#### 6. Lowest skyscraper located adjacent to clue 2

Whenever a 1-floor skyscraper is adjacent to clue 2, the next square must contain the highest skyscraper. In the example below, a 5-floor skyscraper which is the highest in a 5x5 grid must be placed in the second square of the bottom row. Any other skyscraper would cause more than two buildings to be visible when viewing the bottom row from the direction of the clue.

#### 7. Second highest skyscraper in second-square from clue 2

It is impossible to place the second highest skyscraper in the second square from clue 2. For example, let’s try placing a 4-floor skyscraper in the second column as shown in the left image below. We can immediately see this is impossible because any skyscraper we place above it will cause either one skyscraper or three skyscrapers to be visible when viewing the column from the direction of the clue.

## Advanced techniques

The techniques described so far won’t be enough to solve more difficult puzzles. At some point when solving medium and hard puzzles you will find it necessary to combine different techniques or think what might happen one or two steps ahead. For this you will need to use advanced techniques to work out many special and interesting logic situations. Here are some examples of advanced techniques. You will develop many more of your own when solving medium and hard Skyscrapers puzzles by yourself:

#### 1. Advanced technique 1

Let’s try to figure out which skyscraper should be placed in the square with the question mark below. There are two obvious possibilities, 3-floor or 4-floor, since any other skyscraper will violate the requirement of clue 2 on the right. However, placing a 3-floor skyscraper will force us to place the 4-floor skyscraper in the left-most square of the second row which is not allowed because the left column already contains such skyscraper. Therefore, the only candidate for the square with the question mark is a 4-floor skyscraper.

#### 2. Advanced technique 2

Below is another partially solved puzzle. Let’s analyze where a 4-floor skyscraper can be placed in the center column. The top square is obviously not a candidate since there is already a 4-floor skyscraper in the top row. However, the squares immediately above and below the 5-floor skyscraper are also not candidates: placing a 4-floor skyscraper in either of these squares will cause violation of clues 2 above or below this column. This means the only square in which a 4-floor skyscraper can be placed is at the bottom of the center column.

#### 3. Advanced technique 3

Let’s see where a 5-floor skyscraper can be placed in the right-hand column. The top square is not a candidate because of clue 2 and the bottom square is not a candidate either because there is already a 5-floor skyscraper in that row. But what about the second and third squares from the top? If we place a 5-floor skyscraper in the second square of the right-hand column then we would have to place a 4-floor skyscraper in the left square of the second row to comply with clue 2 on the left. However, the left-hand column already contains a 4-floor skyscraper so this option is not possible either. This means the third square in the right-hand column is the only candidate in which a 5-floor skyscraper can be placed.

#### 4. Advanced technique 4

We now look which skyscraper can be placed in the second square of the right-hand column in the puzzle below. Since 4-floor and 5-floor skyscrapers are already placed in the respective row and column the remaining candidates are 1-floor, 2-floor and 3-floor skyscrapers. If we try to place a 1-floor skyscraper we immediately see it is not possible to comply with clue 3 on the right. Whichever way we try to arrange the skyscrapers we can’t make 3 buildings visible when viewed from that direction. On the other hand, if we try to place a 3-floor skyscraper we are forced to place a 4-floor skyscraper above it which is not possible due to the requirements of clue 3 in the top-right corner. Therefore the only candidate for this square is a 2-floor skyscraper

#### 5. Advanced technique 5

Looking at the bottom row of the partially solved puzzle below we see the two squares on the right can only be 1-floor and 2-floor skyscrapers though we don’t know in which order. Any other skyscraper cannot be placed because of the two clues of 4. This leaves 3-floor, 4-floor and 5-floor skyscrapers as the remaining candidates for the center square of the bottom row. A 3-floor skyscraper is obviously not possible because the center column already contains a building with this height. A 5-floor skyscraper is also not possible either, because this will conflict with clue 4 on the right. This means the only remaining candidate for the center square in the bottom row is a 4-floor skyscraper.

#### 6. Advanced technique 6

In the right-hand column of the puzzle below, the third square can only be a 1-floor or 2-floor skyscraper. Any higher skyscraper will conflict with clue 4 on the right. This means the 4-floor and 5-floor skyscrapers can only be placed in the two top squares of this column though we don’t yet know in which order. However, if we try placing the 4-floor skyscraper in the top square, we will quickly find there is no way to place the remaining skyscrapers without violating the requirements of clue 4 on the bottom. This means the top square of the right-hand column must contain a 5-floor skyscraper followed with a 4-floor skyscraper under it.