Two line solution of C++


  • 0
    J

    I have a simple solution about this question

    class Solution {
    public:
        int minDepth(TreeNode* root) {
            if(root == NULL) return 0;
            else return std::min((1 + minDepth(root->left)), (1 + minDepth(root->right)));
        }
    };
    

Log in to reply
 

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