@@ -0,0 +1,1276 @@
+package leetcode.binary_tree_right_side_view;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0Aimport java.util.Queue;%0A%0Aimport common.TreeNode;%0A%0Apublic class Solution %7B%0A    public static class TreeNodeWithDepth%7B%0A        TreeNode node;%0A        int depth;%0A        public TreeNodeWithDepth(TreeNode node, int depth)%7B%0A            this.node = node;%0A            this.depth = depth;%0A        %7D%0A    %7D%0A    public List%3CInteger%3E rightSideView(TreeNode root) %7B%0A        List%3CInteger%3E solution = new ArrayList%3CInteger%3E();%0A        Queue%3CTreeNodeWithDepth%3E queue = new LinkedList%3CTreeNodeWithDepth%3E();%0A        if(root != null)%7B%0A            int curDepth = -1;%0A            queue.offer(new TreeNodeWithDepth(root, 0));%0A            while(!queue.isEmpty())%7B%0A                TreeNodeWithDepth twd = queue.remove();%0A                if(twd.node != null)%7B%0A                    if(curDepth %3C twd.depth)%7B%0A                        solution.add(twd.node.val);%0A                        curDepth = twd.depth;%0A                    %7D%0A                    queue.offer(new TreeNodeWithDepth(twd.node.right, twd.depth + 1));%0A                    queue.offer(new TreeNodeWithDepth(twd.node.left, twd.depth + 1));%0A                %7D%0A            %7D%0A        %7D%0A        return solution;%0A    %7D%0A%7D%0A

Add java solution for 199. Binary Tree Right Side View