Question about C++ 3ms solution


  • 0
    3

    I have resolved this problem using DFS by C++, it take 6ms. This solution only beat 15%, because there are other take only 3ms. That solution use a vector to store value of traveled node and separate level from level by using a TreeNode flag(0). It's mean that TreeNode with val == 0 will exclude from all input data.

    So, are there any pre-defined condition of input?


Log in to reply
 

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