[Python3] DFS (Recursive and Iterative) + BFS - Simple Solution
Idea\n- in here we just need the most left value of the last row. Thus we just know the current row and is it the current most deepest row we traversed. If the 
### Idea\n- in here we just need the most left value of the last row. Thus we just know the current row and is it the current most deepest row we traversed. If the current row is the deepest row we have traveled so far, then we take the current value and update the deepest row. How to make the current value is the left. Just do it post-order (left -> right -> val).\n- In here I implement both recursively and iteratively. Most of time, if you can do it recursively, you can also do it iteratively. Because the idea of iterative implementaion is the same as recursive one.\n\n### Code\n##### 1. DFS - recursive (post-order)\n```\ndef findBottomLeftValue(self, root: Optional[TreeNode]) -> int:\n    self.last_left, self.last_row = 0, -1\n\n    def dfs(cur_node: Optional[TreeNode], cur_row: int):\n        if not cur_node:\n            return\n\n        if cur_row > self.last_row:\n            self.last_row = cur_row\n            self.last_left = cur_node.val\n\n        dfs(cur_node.left, cur_row + 1)\n        dfs(cur_node.right, cur_row + 1)\n\n    dfs(root, 0)\n\n    return self.last_left\n```\n##### 2.  DFS - iterative (stack)\n```\ndef findBottomLeftValue(self, root: Optional[TreeNode]) -> int:\n    last_left, last_row = 0, -1\n\n    stack = [(root, 0)]\n    while stack:\n        cur_node, row = stack.pop()\n\n        if row > last_row:\n            last_row = row\n            last_left = cur_node.val\n\n        if cur_node.right:\n            stack.append((cur_node.right, row + 1))\n\n        if cur_node.left:\n            stack.append((cur_node.left, row + 1))\n\n    return last_left\n```\n\n##### 3. DFS One-liner\n```\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\nclass Solution:\n    def findBottomLeftValue(self, r: Optional[TreeNode]) -> int:\n        return (f:=lambda n,p:n and ((q:=max((0,3,n.val),f(n.left,2),f(n.right,1)))[0]+1,p,q[2]) or (0,0,0))(r,0)[2]\n```\n\n##### 4. BFS\n\n```\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\nclass Solution:\n    def findBottomLeftValue(self, root: Optional[TreeNode]) -> int:\n        last_left = -1\n        dq = collections.deque([root])\n        while dq:\n            n = len(dq)\n            last_left = dq[0].val\n            for _ in range(n):\n                node = dq.popleft()\n                if node.left: dq.append(node.left)\n                if node.right: dq.append(node.right)\n        return last_left\n```\n
['Stack', 'Depth-First Search', 'Breadth-First Search', 'Recursion', 'Python']