Two line c++ no flag. Who could beat me?


  • 0
    F

    class Solution {
    public:
    int sumOfLeftLeaves(TreeNode* root) {
    if(!root) return 0;
    return (root->left && !root->left->left && !root->left->right? root->left->val:sumOfLeftLeaves(root->left)) + sumOfLeftLeaves(root->right);
    }
    };


Log in to reply
 

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