当前位置:
首页 >
【leetcode】590. N-ary Tree Postorder Traversal
发布时间:2025/3/8
44
豆豆
生活随笔
收集整理的这篇文章主要介绍了
【leetcode】590. N-ary Tree Postorder Traversal
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
题目如下:
解题思路:凑数题+2,做完先序做后序。凑数博+2。
代码如下:
class Solution(object):def postorder(self, root):""":type root: Node:rtype: List[int]"""if root == None:return []res = []stack = [root]while len(stack) > 0:node = stack.pop(0)res.insert(0,node.val)for i in node.children:stack.insert(0, i)return res
转载于:https://www.cnblogs.com/seyjs/p/9397687.html
总结
以上是生活随笔为你收集整理的【leetcode】590. N-ary Tree Postorder Traversal的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Sgen.exe: Speed up X
- 下一篇: ts基础总结