C++ | Used pair instead of defining new Class| 100% faster 0ms | dfs
\nclass Solution {\npublic:\n    \n    pair<TreeNode* , int> helper(TreeNode* root)\n    {\n       if(root == NULL) return {NULL,0};        \n        pair l = h
```\nclass Solution {\npublic:\n    \n    pair<TreeNode* , int> helper(TreeNode* root)\n    {\n       if(root == NULL) return {NULL,0};        \n        pair l = helper(root->left) , r = helper(root->right);\n        if(l.second > r.second) return {l.first , l.second + 1};\n        if(l.second < r.second) return {r.first , r.second + 1};\n        return {root,l.second + 1};\n    }\n    TreeNode* subtreeWithAllDeepest(TreeNode* root) {\n        return helper(root).first;\n    }\n};\n```
['Depth-First Search', 'C']