LeetCode Binary Tree Zigzag Level Order Traversal
Given a binary tree,return the zigzag level order traversal of its nodes' values. (ie,from left to right,then right to left for the next level and alternate between).
For example: 3
/
9 20
/
15 7
return its zigzag level order traversal as: [
[3],[20,9],[15,7]
]
confused what OJ's Binary Tree Serialization: The serialization of a binary tree follows a level order traversal,where '#' signifies a path terminator where no node exists below. Here's an example: 1
/
2 3
/
4
5
The above binary tree is serialized as (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |