Python | Leetcode Python题解之第513题找树左下角的值
题目:
题解:
class Solution:def findBottomLeftValue(self, root: Optional[TreeNode]) -> int:q = deque([root])while q:node = q.popleft()if node.right:q.append(node.right)if node.left:q.append(node.left)ans = node.valreturn ans