LeetCode – Binary Tree Level Order Traversal II (Java)

Given a binary tree, return the bottom-up level order traversal of its nodes’ values. For example, given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7 return its level order traversal as [[15,7], [9,20],[3]] Java Solution public List<ArrayList<Integer>> levelOrderBottom(TreeNode root) { ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();   if(root == null){ return result; … Read more