Java Binary Tree
\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     int val;\n *     TreeNode left;\n *     TreeNode right;\n *     TreeNode() {}\n
```\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     int val;\n *     TreeNode left;\n *     TreeNode right;\n *     TreeNode() {}\n *     TreeNode(int val) { this.val = val; }\n *     TreeNode(int val, TreeNode left, TreeNode right) {\n *         this.val = val;\n *         this.left = left;\n *         this.right = right;\n *     }\n * }\n */\nclass Solution {\n        static int xkaleft;\n        static int xkaright;\n        \n        public static int size(TreeNode node,int x){\n                if(node == null){\n                        return 0;\n                }\n                \n                int ls = size(node.left,x);\n                int rs = size(node.right,x);\n                \n                int ts = ls + rs + 1;\n                \n                if(node.val == x){\n                        xkaleft = ls;\n                        xkaright = rs;\n                }\n                return ts;\n                \n        }\n        public boolean btreeGameWinningMove(TreeNode root, int n, int x) {\n                \n                size(root,x);\n                \n                int otherside = n - (xkaleft + xkaright + 1);\n                int maxofthree = Math.max(otherside,Math.max(xkaleft,xkaright));\n                \n                int rest = n - maxofthree;\n                \n                if(maxofthree > rest){\n                        return true;\n                }\n                \n                return false;\n        \n    }\n}\n```
['Binary Tree', 'Java']