# Straight Forward appending right to left list (without range computation)

• I tried to find a similar approach in other's solutions but couldn't. (Let me know if I missed any)

Short description

1. Use two list: LeftList and RightList
2. Append the node value to either LeftList or RightList according to an offset (centered at root)
3. When BFS is done, append RightList to reversed LeftList
4. Return LeftList

public class Solution {

``````    public List<List<Integer>> verticalOrder(TreeNode root) {
if(root == null) return new ArrayList<List<Integer>>();

List<List<Integer>> left = new ArrayList<>();
List<List<Integer>> right = new ArrayList<>();
verticalOrder(root, left, right);
Collections.reverse(left);
return left;
}

public void verticalOrder(TreeNode root, List<List<Integer>> left, List<List<Integer>> right) {
// do BFS

int offset;
List<Integer> list;
while(!queue.isEmpty()) {
TreeNode node = queue.poll();
offset = offsetQ.poll();

if(offset < 0) { // left subtrees
list = left.get(-offset-1);
} else { // root and right subtrees
list = right.get(offset);
}

if(node.left != null) {