Regarding empty test case

  • 4

    This problem has a test case for testing whether there is any path sum 0 for an empty binary tree.

    It expects the result as false. But I think it's more intuitive to state the result as true.

  • 0

    because this a root to leaf path. And this case makes the recursive easier to implement.
    Moreover, to distinguish the case {0},0 and {}, 0 , this kind of setting is also pretty intuitive.

Log in to reply

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