[Simple] [C++] solution
Runtime: 4 ms, faster than 85.18% of C++ online submissions for Smallest Subtree with all the Deepest Nodes.\nMemory Usage: 14.5 MB, less than 100.00% of C++ on
*Runtime: 4 ms, faster than 85.18% of C++ online submissions for Smallest Subtree with all the Deepest Nodes.\nMemory Usage: 14.5 MB, less than 100.00% of C++ online submissions for Smallest Subtree with all the Deepest Nodes.*\n\n```\nclass Solution {\npublic:\n    TreeNode* subtreeWithAllDeepest(TreeNode* root) {\n        if(root == NULL){\n            return NULL;\n        }\n        int leftDepth = getDepth(root->left); \n        int rightDepth = getDepth(root->right);\n        if(leftDepth == rightDepth){\n            return root;\n        }\n        else{\n            if(leftDepth > rightDepth){\n                return subtreeWithAllDeepest(root->left);\n            }else {\n             return subtreeWithAllDeepest(root->right);   \n            }\n        }\n    }\n    //to calculate the height\n    int getDepth(TreeNode* node){\n        if(node == NULL){\n            return 0;\n        }\n        return 1 + max(getDepth(node->left), getDepth(node->right));\n    }\n    \n};\n```
['Recursion', 'C']