Given an n-ary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example, given a 3-ary tree: We should return its level order traversal: [ [1], [3,2,4], [5,6] ] Note: The depth of the tree is…
题目来源:429. N-ary Tree Level Order Traversal https://leetcode.com/problems/n-ary-tree-level-order-traversal/ 自我感觉难度/真实难度:hard/easy 队列操作不熟悉 题意: 层序遍历树 分析: 自己的代码: """ # Definition for a Node. class Node(object): def __init__(self, val, children)…