Python | Leetcode Python题解之第559题N叉树的最大深度

题目:

题解:

python 复制代码
class Solution:
    def maxDepth(self, root: 'Node') -> int:
        if root is None:
            return 0
        ans = 0
        queue = [root]
        while queue:
            queue = [child for node in queue for child in node.children]
            ans += 1
        return ans
相关推荐
Maya动画技术2 分钟前
pptx批量转png图片工具
python
MoRanzhi120331 分钟前
第4篇 · 使用 PyQt5 实现 2048:平滑动画与性能优化
python·性能优化·qtimer·pyqt5·qpainter·gui动画·2048游戏
wenyq733 分钟前
LeetCode 123. Best Time to Buy and Sell Stock III
leetcode
海姐软件测试1 小时前
Python 自动化与 AI 结合:基于 Jenkins 的回归验证实践
人工智能·python·自动化
Haoyunyi1 小时前
2026年做期货量化,和三年前已经不是一回事了
大数据·人工智能·python·金融·区块链
再__努力1点1 小时前
一个开源的AI边缘计算平台:一个项目把算能、瑞芯微、x86的NPU全打通了
人工智能·python·课程设计·媒体·流媒体
小oo呆1 小时前
【学习心得】Python函数参数中的两个特殊分隔符
开发语言·python
SEO_juper2 小时前
AI 爬虫 robots.txt 检查工具:你的站是不是把 AI 挡在门外了
开发语言·人工智能·爬虫·python·外贸独立站
看我debug2 小时前
Android 运行时分析工作台 (Demo)。统一管理 Frida 脚本、自动注入(修改运行时代码)、收集结构化结果、生成 JSON 报告。
android·python·pip
染指11102 小时前
151.Agent-LangGraph-Send发送(Map-Reduce模式)
人工智能·python·langchain·状态模式·agents