Beats 100% 100%  - With Explanation  - Java
\nidea is simple,\nsecond player has 3 options to block player one,\n1. Block moving to its left child\n2. Block moving to its right child\n3. Block moving to i
\nidea is simple,\nsecond player has 3 options to block player one,\n1. Block moving to its left child\n2. Block moving to its right child\n3. Block moving to its parent\n\nAs player one started first the win is only possible if you have more than n/2 nodes in either one of them, beacuse player one can chose again after you pick.\n\nAlgo\n1. For a node x, get count of left and right -> post order will do\n2. Num of nodes in parent side  = n - (leftCount + rightCount) - 1\n3. If max(leftCount, rightCount, parentCount) > n/2 -> win possible, return tru\n\nSo, we need a node that has more than n/2 nodes to win \n\n```\nclass Solution {\n    int leftCount, rightCount;\n\n  public boolean btreeGameWinningMove(TreeNode root, int n, int x) {\n    count(root, x);\n    return Math.max(Math.max(leftCount, rightCount), n - leftCount - rightCount - 1) > n / 2;\n  }\n\n  private int count(TreeNode node, int x) {\n    if (node == null)\n      return 0;\n    int l = count(node.left, x);\n     int r = count(node.right, x);\n    if (node.val == x) {\n      leftCount = l;\n      rightCount = r;\n    }\n    return l + r + 1;\n  }\n\n}\n```
[]