What is wrong with this?


  • 0
    B
    int left_ele = 0, maxlevel=0;
    void helper(struct TreeNode* root, int level) {
        if(root){
            helper(root->left, level+1);
            helper(root->right, level+1);
            if(level > maxlevel){
                maxlevel = level;
                left_ele = root->val;
            }
        }
    }
    int findBottomLeftValue(struct TreeNode* root) {
        left_ele = root->val;
        helper(root, 0);
        return left_ele;
    }
    
    

Log in to reply
 

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