Tap here to switch tabs
Problem
Submissions

Problem: Binary Tree Vertical Order Traversal

Binary Tree Vertical Order Traversal groups a binary tree’s values by column, listing columns from left to right and nodes from top to bottom, with same-position nodes ordered left to right.

Statement

Given the root of a binary tree, return the vertical order traversal of its nodes’ values, organized column by column from top to bottom.

For any two nodes that share the same row and column, they should appear from left to right in the output.

Constraints:

  • The number of nodes in the tree is in the range [0,100][0, 100]

  • −100≤-100 \leq Node.val ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Binary Tree Vertical Order Traversal

Binary Tree Vertical Order Traversal groups a binary tree’s values by column, listing columns from left to right and nodes from top to bottom, with same-position nodes ordered left to right.

Statement

Given the root of a binary tree, return the vertical order traversal of its nodes’ values, organized column by column from top to bottom.

For any two nodes that share the same row and column, they should appear from left to right in the output.

Constraints:

  • The number of nodes in the tree is in the range [0,100][0, 100]

  • −100≤-100 \leq Node.val ≤100\leq 100