Skyscraper Solver - Free Online Skyscraper Puzzle Solver
What Is a Skyscraper Puzzle?
Skyscraper (also sold as Towers) is a Latin-square logic puzzle with a spatial twist. Fill an N×N grid so every row and column contains the digits 1 to N exactly once - each digit is the height of a skyscraper. The numbers around the outside of the grid are visibility clues: looking from that edge, they tell you how many buildings you can see. A taller building hides everything behind it, so the sequence 2-1-4-3 shows only two skyscrapers from the left (the 2 and the 4) but four from the right.
This free Skyscraper solver takes the edge clues for a 4×4 to 7×7 grid - plus any given heights you already know - and completes the grid, reporting whether the solution is unique.
Skyscraper Rules
Latin square core. Every row and every column contains 1 to N exactly once.
Visibility clues. Each outside number counts the skyscrapers visible from that direction; a clue of N means the row or column is in perfect ascending order from that side.
0 means no clue. Some edges have no information - any arrangement is allowed there.
Givens are allowed. Some puzzles pre-fill a few heights.
How to Use the Skyscraper Solver
Choose a grid size. Tap 4×4 up to 7×7.
Enter the edge clues in the slim strips around the grid - 0 for edges with no clue.
Enter any givens inside the grid (shown in blue).
Press Solve. The grid completes and the status line reports whether the solution is unique.
Reset or explore. Clear wipes everything, and Example generates a puzzle with a guaranteed unique solution (some cells come pre-filled as givens).
What the Solver Tells You
When the clues pin down a single grid, everything fills in and the solver confirms uniqueness - like this example with its edge clues and pre-filled givens:

If the clue set is contradictory or underdetermined beyond repair, the solver reports it instead of guessing:

How the Skyscraper Solver Works
The engine combines two classic techniques. First, every row is a permutation of 1 to N, so the solver precomputes all N! permutations and keeps only those whose left and right visibility counts match the clues - the same filter is prepared for columns using the top and bottom clues. Second, it fills the grid row by row from the top, maintaining for every column a live list of column candidates: after each row is placed, any column permutation that disagrees with the placed heights is discarded (prefix filtering). A row candidate is only explored if every column still has at least one surviving permutation.
This dual filtering makes the search radically smaller than raw backtracking: at each row the candidate counts collapse, and the search terminates after finding two solutions - which is how the solver knows whether your puzzle is uniquely determined. The Example generator uses the reverse process: it builds a random completed grid, derives all edge clues, then removes clues one by one while the solution stays unique, and finally reveals a handful of heights as givens to guarantee uniqueness.
Tips for Solving Skyscraper Puzzles
Start with extreme clues. A clue of N means the row or column is 1, 2, ..., N in perfect order from that side; a clue of 1 means the first cell from that side is N itself.
Pair opposite clues. Clues of 2 and 3 on opposite ends of the same line heavily restrict the arrangement - list the permutations that satisfy both.
Use the tallest building as an anchor. The position of N is forced by clues of 1 (N sits at that edge) and bounds every other visibility count.
Think in permutations per line. Write down all legal arrangements for a clue pair, then eliminate by column conflicts - the intersection is usually tiny.
Remember taller hides shorter. Visibility only counts new records: in 3-1-2-4 the 1 and 2 are invisible behind the 3.
Is Skyscraper Good for Your Brain?
Skyscraper trains spatial reasoning - literally imagining skylines from four directions - on top of Latin-square elimination. The visibility clues force perspective switching: the same line reads differently from each side, so you constantly reconcile four viewpoints into one grid. It is an outstanding exercise for constraint visualisation and pairs naturally with Sudoku-style elimination practice.
Frequently Asked Questions
What is a Skyscraper puzzle?
A Latin-square puzzle where digits are building heights and the numbers outside the grid count how many buildings are visible from each direction.
What does a clue of 1 or N mean?
A clue of 1 means the nearest building is the tallest (N) - it hides everything behind it. A clue of N means the line ascends perfectly from that side: 1, 2, ..., N.
How is Skyscraper different from Sudoku?
Both use Latin-square rows and columns, but Skyscraper has no 3×3 boxes and replaces box logic with edge visibility clues.
Can a Skyscraper puzzle have multiple solutions?
Yes, if too few clues are given. Well-made puzzles are unique, and this solver verifies uniqueness before showing an answer.
Why does the Example have pre-filled cells?
Some random layouts need a few givens to guarantee a unique solution. The generator adds the minimum needed, shown in blue - you can overwrite them to explore.
What sizes does the solver support?
4×4, 5×5, 6×6 and 7×7.
Is this Skyscraper solver free?
Completely free with no sign-up. Solving runs entirely in your browser after the page loads, so it even works offline.
More Logic Puzzles to Explore
Enjoy Latin-square logic? Try the Futoshiki Solver (inequality signs instead of visibility), play our free Sudoku game, or explore the 24 Game Solver.
