leetcode|C++|2020.8笔记

104.

题解

class Solution {
public:
    int maxDepth(TreeNode* root) {
        if (root == nullptr) return 0;
        return max(maxDepth(root->left), maxDepth(root->right)) + 1;
    }
};

C++中NULL和nullptr的区别

空指针 -> nullptr

https://blog.csdn.net/qq_18108083/article/details/84346655

max(b,a)

#include<algorithm>

//leetcode中可直接调用

posted @ 2020-08-02 19:02  olhhh  阅读(83)  评论(0)    收藏  举报