C++ easy fast and short code
\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode() : val(0)
```\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode() : val(0), left(nullptr), right(nullptr) {}\n *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}\n * };\n */\nclass Solution {\npublic:\n    TreeNode* subtreeWithAllDeepest(TreeNode* root) \n{\n    return fun(root);    \n}\nTreeNode* fun(TreeNode* root)\n{\n\t\n    int left_h = geth(root->left);\n    int right_h = geth(root->right);\n    \n    //if on the curr root -->\n    \n    //if we have left_h more than the right_h  --> deepest leaves are present in the left then we would go in the left to generate the ans\n    if(left_h > right_h)\n    {\n    \treturn fun(root->left);\n\t}\n\t//if we have right_h more than the right_h -->deepest leaves are present in the right then we would go in the right to generat the ans\n\telse if(right_h > left_h)\n\t{\n\t\treturn fun(root->right);\n\t}\n\telse if(right_h == left_h)\n\t{\n\t\treturn root;\n\t}\n    return NULL;\n}\nint geth(TreeNode* root)\n{\n\tif(root==NULL)\n\t{\n\t\treturn 0;\n\t}\n\treturn 1 + max(geth(root->left),geth(root->right));\n}\n};\n```
['Depth-First Search', 'Recursion', 'C', 'C++']