[C++] Clean Code - DFS Recursion with Explanation
Imaging how we would find the max height of a tree. We can carry a max-height variable and keep updating it.\nWith little change we can find the bottom-left as 
Imaging how we would find the max height of a tree. We can carry a ``max-height`` variable and keep updating it.\nWith little change we can find the ``bottom-left`` as a byproduct of this process.\n\nThe idea is to update the ``bottom-left`` only when the depth reach to the next level, that is, whenever you need to update ``max-height`` when ``height > max-height``;\n\n**Find Bottom Left**\n```\nclass Solution {\npublic:\n    int findBottomLeftValue(TreeNode* root) {\n        int bottomLeft = 0;\n        int height = 0;\n        dfs(root, 1, height, bottomLeft);\n        return bottomLeft;\n    }\n\nprivate:\n    void dfs(TreeNode* node, int depth, int& height, int& res) {\n        if (!node) {\n            return;\n        }\n        if (depth > height) {\n            res = node->val;    // update res only when redefine the height\n            height = depth;\n        }\n        dfs(node->left, depth + 1, height, res);\n        dfs(node->right, depth + 1, height, res);\n    }\n};\n```\n\n**Find Tree Height**\nHere is how would you find the height of the tree in this approach, it is very similar to Find The Bottom Left\n```\nclass Solution {\npublic:\n    int treeHeight(TreeNode* root) {\n        int height = 0;\n        dfs(root, 1, height);\n        return height;\n    }\n\nprivate:\n    void dfs(TreeNode* node, int depth, int& height) {\n        if (!node) {\n            return;\n        }\n        if (depth > height) {\n            height = depth;\n        }\n        dfs(node->left, depth + 1, height);\n        dfs(node->right, depth + 1, height);\n    }\n};\n```
[]