Intepretation of TreeNode


  • -1
    S
    /**
     * Definition for binary tree
     * struct TreeNode {
     *     int val;
     *     TreeNode *left;
     *     TreeNode *right;
     *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
     * };
     */
    

    what does TreeNode(int x) : val(x), left(NULL), right(NULL) {} mean in the question ?


  • 0
    S

    I just edit your code format. Please pay attention next time. Thanks.


  • 1
    S

    This definition tells you the structure of tree node in OJ.

    TreeNode(int x) : val(x), left(NULL), right(NULL) {} indicates how to create a new tree node. But actually it won't be used in this problem.


Log in to reply
 

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