The Skyline Problem
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are given the locations and height of all the buildings, write a program to output the skyline formed by these buildings collectively. The skyline would be returned as a set of key points.
Algorithm in short -
1. Compare key points of skylines starting from leftmost end.
Choose the one having lesser of ‘x’ value.
2. If ‘y’ value of chosen key point is less than last seen height of other skyline, update key point’s ‘y’ to last seen height of other skyline.
3. Proceed to next key point of the chosen skyline.
4. Repeat above steps till both the skylines are completed.
5. Remove the redundant key points.
Website: http://www.ideserve.co.in
Facebook: https://www.facebook.com/IDeserve.co.in
Видео The Skyline Problem канала IDeserve
Algorithm in short -
1. Compare key points of skylines starting from leftmost end.
Choose the one having lesser of ‘x’ value.
2. If ‘y’ value of chosen key point is less than last seen height of other skyline, update key point’s ‘y’ to last seen height of other skyline.
3. Proceed to next key point of the chosen skyline.
4. Repeat above steps till both the skylines are completed.
5. Remove the redundant key points.
Website: http://www.ideserve.co.in
Facebook: https://www.facebook.com/IDeserve.co.in
Видео The Skyline Problem канала IDeserve
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
![Skyline Problem](https://i.ytimg.com/vi/GSBLe8cKu0s/default.jpg)
![Coding Interview Problem: Largest Rectangle in a Histogram](https://i.ytimg.com/vi/VNbkzsnllsU/default.jpg)
![2. Divide & Conquer: Convex Hull, Median Finding](https://i.ytimg.com/vi/EzeYI7p9MjU/default.jpg)
![M16-Divide and Conquer Defective Chess Board](https://i.ytimg.com/vi/lQhNiv3w45w/default.jpg)
![Print Matrix Diagonally](https://i.ytimg.com/vi/IDxaZrrggu0/default.jpg)
![Longest Common Subsequence](https://i.ytimg.com/vi/NnD96abizww/default.jpg)
!["Median of two sorted Arrays": A Google Software Engineering Interview Question PART 1](https://i.ytimg.com/vi/CMjAo8_8JYM/default.jpg)
![I got fired from Facebook (for having a YouTube channel).](https://i.ytimg.com/vi/2pIJoPkh9IU/default.jpg)
![Serialize and Deserialize a Binary Tree](https://i.ytimg.com/vi/jwzo6IsMAFQ/default.jpg)
![Closest Pair of Points | Divide and Conquer | GeeksforGeeks](https://i.ytimg.com/vi/0W_m46Q4qMc/default.jpg)
![Facebook Interview: K Most Frequent Elements - Whiteboard Thursday](https://i.ytimg.com/vi/EYFcQRwcqk0/default.jpg)
![The Egg Dropping Problem - Interview Question](https://i.ytimg.com/vi/o_AJ3VWQMzA/default.jpg)
![JavaScript LeetCode 218: The Skyline Problem (Cat Racket Code F244) [English]](https://i.ytimg.com/vi/mrqLYF362GU/default.jpg)
![Google Interview Question | Running median in a stream of numbers](https://i.ytimg.com/vi/1CxyVdA_654/default.jpg)
![Topological Sort](https://i.ytimg.com/vi/71eHuQvSwc0/default.jpg)
![Google Interview Problem: Trapping Rain Water Part 1](https://i.ytimg.com/vi/HmBbcDiJapY/default.jpg)
![Find a peak element in an array](https://i.ytimg.com/vi/a7D77DdhlFc/default.jpg)
![【每日一题:小Fu讲解】LeetCode 218. The Skyline Problem](https://i.ytimg.com/vi/11dq8ux25oE/default.jpg)
![Amazon Interview Question: Snake Ladder Problem [Logicmojo.com]](https://i.ytimg.com/vi/OutDY_ICb80/default.jpg)