根据二插树的节点间的位置关系, left_child = root * 2, right_child = root * 2 + 1 利用层序遍历,进行判断处理 class Solution: def widthOfBinaryTree(self , root: TreeNode) -> int: """ {1,2,3,4,#,4,5,6,#,1} {1,#,1,#,1 #,1,#,1,#,1,#,4,2} """ # write code here if not root: return 0 q = [(root, 0, 0)] dept = l_pos = 0 res = 0 for ...