Is the testing case wrong?


  • 0

    I got the wrong answer with log like this:

    [[9,7],[1,9],[3,1]]
    Output:
    [7,16,16]
    Expected:
    [7,16,17]

    Can anybody explain why is the expection output or the testing case is wrong?


  • 0

    @victorzhang21503 Expected is correct.

    • The first square is from x = 9 to x = 16, and has a height of 7. The bottom edge is at y = 0.
    • The second square is from x = 1 to x = 10, and has a height of 16. The bottom edge is at y = 7.
    • The third square is from x = 3 to x = 4, and has a height of 17. The bottom edge is at y = 16.

  • 0

    @awice Thanks to explain, I see why my understanding before was wrong. The square as a whole could not be splited to hit the lowest ground!


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.