C# Solution for Find Bottom Left Tree Value Problem
Intuition\n Describe your first thoughts on how to solve this problem. \nThe intuition behind this solution is to perform a depth-first traversal (DFS) of the b
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe intuition behind this solution is to perform a depth-first traversal (DFS) of the binary tree, keeping track of the leftmost value at each level. The result is updated whenever a deeper level is encountered during the traversal.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1.\tInitialize maxDepth and leftmostValue variables.\n2.\tPerform a depth-first traversal of the binary tree.\n3.\tUpdate leftmostValue whenever a deeper level is encountered.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nThe time complexity is O(N), where N is the number of nodes in the binary tree. In the worst case, we need to visit all nodes during the depth-first traversal.\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nThe space complexity is O(H), where H is the height of the binary tree. This is the maximum depth of the recursive call stack. In the worst case, for a skewed tree, the space complexity approaches O(N).\n\n# Code\n```\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     public int val;\n *     public TreeNode left;\n *     public TreeNode right;\n *     public TreeNode(int val=0, TreeNode left=null, TreeNode right=null) {\n *         this.val = val;\n *         this.left = left;\n *         this.right = right;\n *     }\n * }\n */\npublic class Solution {\n    private int maxDepth = -1;\n    private int leftmostValue = -1;\n    public int FindBottomLeftValue(TreeNode root) {\n        DFS(root, 0);\n        return leftmostValue;\n    }\n\n    private void DFS(TreeNode node, int depth) {\n        if (node == null) {\n            return;\n        }\n\n        // Update leftmostValue and maxDepth when encountering a deeper level\n        if (depth > maxDepth) {\n            leftmostValue = node.val;\n            maxDepth = depth;\n        }\n\n        // Recursive calls for left and right children\n        DFS(node.left, depth + 1);\n        DFS(node.right, depth + 1);\n    }\n}\n```
['C#']