Questions about one test


  • 0
    A

    For tree as follows

                1
              /   \
             2    3
            /     / \
           4     6  7    
          /  \
         6  7
    

    p.val = 6, q.val = 7

    what output should I return?


  • 2

    Depends on what p and q are. Which 6 is p, and which 7 is q? It's impossible to tell just from the values. Fortunately, you are given the nodes, not just the values.


  • 0
    I

    Comparison should be done by node references, not node values.


Log in to reply
 

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