C++ easy fast and short code
\nclass Solution {\npublic:\n    \n    unordered_set <TreeNode*> m;\n    int n;\n    TreeNode *ans = NULL;\n    \n    int solve(TreeNode *root)\n    {\n        
```\nclass Solution {\npublic:\n    \n    unordered_set <TreeNode*> m;\n    int n;\n    TreeNode *ans = NULL;\n    \n    int solve(TreeNode *root)\n    {\n        if(!root or ans) return 0;\n        \n        int left = solve(root->left);\n        int right = solve(root->right);\n        \n        int x = left+right;\n        \n        if(m.find(root)!=m.end())\n        x++;\n        \n        if(x==n and !ans)\n        ans = root;\n        \n        return x;\n    }\n    \n    TreeNode* subtreeWithAllDeepest(TreeNode* root) {\n        queue<TreeNode*> q, temp;\n        q.push(root);\n        \n        while(q.size())\n        {\n            temp = q;\n            int n = q.size();\n            for(int i = 0;i<n;i++)\n            {\n                TreeNode *r = q.front();\n                q.pop();\n                \n                if(r->left)\n                q.push(r->left);\n                \n                if(r->right)\n                q.push(r->right);\n            }\n        }\n        \n        while(temp.size())\n        {\n            m.insert(temp.front());\n            temp.pop();\n        }\n        n = m.size();\n        \n        solve(root);\n        return ans;\n    }\n    \n};\n```\n**UPVOTE!**
['C']