Why not consider about edge cases?


  • 1

    When this question comes to me, I first consider about the "int[][] obstacleGrid" is null or empty. However, the top solutions assume that "int[][] obstacleGrid" is not null or empty, and pass.

    I know it means that there is no empty "int[][] obstacleGrid" in the test cases. So, why about meeting such question in the interview? Do we need to take such edge cases into consideration?


  • 0

    I believe yes. I try my AC code with input null, it turns out my AC code got error, while expect answer is 0. And the the most interesting part about test case is, if give a input a [[0]], the expected answer is 1.....


Log in to reply
 

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