← 返回 meta 的题目列表Vertical Order Traversal of Binary Tree with Sorting
类型:online_judge
meta
Given a binary tree, return the vertical order traversal of its nodes' values. This means the values should be displayed from top to bottom, and from left to right in vertical sequence order. If multiple nodes are located in the same column and row, they should be displayed in ascending order of their row and node value.
Example
Input:
3
/ \
9 20
/ \
15 7
Output: [[9], [3, 15], [20], [7]]
Constraints:
The number of nodes in the tree is in the range [1, 1000].
-1000 <= Node.val <= 1000.
Example
Input
3
9
15
20
7