Hacker News new | past | comments | ask | show | jobs | submit login

Perhaps I’ve misunderstood the problem, but the second solution shown here doesn’t seem to be correct: it always adds a trailing 0-height entry to the skyline, yet there could be an existing building touching or overlapping the newly added building, whose height is then lost.

For example, the code given appears to make

    skyline [(1, 2, 3), (2, 1, 4)]
evaluate to

    [(1,2),(3,0),(4,0)]
when if I’ve understood correctly it should be

    [(1,2),(3,1),(4,0)]



You are right. Thank you. Going to correct this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: