首页 > 试题广场 >

Department list to tree

[编程题]Department list to tree
  • 热度指数:1112 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 256M,其他语言512M
  • 算法知识视频讲解
Convert the department list to preorder traversal of the name of department tree
示例1

输入

[["d1", "d0", "IT"], ["d2", "d0", "RD"], ["d0", "", "The Company"], ["d3", "d0", "HR"]]

输出

["The Company","HR","IT","RD"]

说明

On each level of the department tree, departments are listed in alphabetical order of the name

这道题你会答吗?花几分钟告诉大家答案吧!