Learn
Practice
Newsletter
Resources
Mobile
New
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
The Skyline Problem
Bookmark
Input
Standard
Simple
Single
Nested
Custom
buildings
=
[[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
heights
0:1
prevMax
0
currentMax
0
result
(empty)
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
heights
0:1
prevMax
0
currentMax
0
result
(empty)
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
h=10
x=2
heights
10:1
0:1
prevMax
0
currentMax
0
result
(empty)
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
h=15
max
[2,10]
x=3
heights
15:1
10:1
0:1
prevMax
10
currentMax
15
result
[[2,10]]
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
h=12
max
[2,10]
[3,15]
x=5
heights
15:1
12:1
10:1
0:1
prevMax
15
currentMax
15
result
[[2,10], [3,15]]
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
h=10
max
[2,10]
[3,15]
[7,12]
x=9
heights
12:1
10:1
0:1
prevMax
12
currentMax
12
result
[[2,10], [3,15], [7,12]]
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
h=12
max
[2,10]
[3,15]
[7,12]
x=12
heights
12:1
0:1
prevMax
12
currentMax
12
result
[[2,10], [3,15], [7,12]]
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
h=10
[2,10]
[3,15]
[7,12]
[12,0]
x=15
heights
10:1
0:1
prevMax
0
currentMax
0
result
[[2,10], [3,15], [7,12], [12,0]]
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
h=8
max
[2,10]
[3,15]
[7,12]
[12,0]
[15,10]
x=19
heights
10:1
8:1
0:1
prevMax
10
currentMax
10
result
[[2,10], [3,15], [7,12], [12,0], [15,10]]
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
h=10
max
[2,10]
[3,15]
[7,12]
[12,0]
[15,10]
[20,8]
x=20
heights
8:1
0:1
10 ✕
prevMax
8
currentMax
8
result
[[2,10], [3,15], [7,12], [12,0], [15,10], [20,8]]
0
3
6
9
12
15
2
4
6
8
10
12
14
16
18
20
22
24
[2,10]
[3,15]
[7,12]
[12,0]
[15,10]
[20,8]
[24,0]
heights
0:1
prevMax
0
currentMax
0
result
[[2,10], [3,15], [7,12], [12,0], [15,10], [20,8], [24,0]]
algo
master
.
io
Step:
Find the skyline outline from building silhouettes
0 / 44
Input
Standard
Simple
Single
Nested
Custom
buildings
=
[[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]
0 / 44
algo
master
.
io
Step:
Find the skyline outline from building silhouettes