摘要: 克隆图 class Solution { private HashMap <Node, Node> visited = new HashMap <> (); public Node cloneGraph(Node node) { if (node == null) { return node; } 阅读全文
posted @ 2021-04-01 20:58 章大佬 阅读(28) 评论(0) 推荐(0)
摘要: 利用深度优先搜索,递归+1 class Solution { public: int maxDepth(TreeNode* root) { if(root==NULL) { return 0; } return max(maxDepth(root->left),maxDepth(root->righ 阅读全文
posted @ 2021-04-01 16:23 章大佬 阅读(18) 评论(0) 推荐(0)