第14459题 单选题
下列关于求解二叉树深度的Python代码的说法中,不正确的是?
def getDepth(root):
    if root is None:
        return 0
    left_depth = getDepth(root.left)
    right_depth = getDepth(root.right)
    if left_depth < right_depth:
        return right_depth + 1
    else:
        return left_depth + 1
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析