py3: binary tree coloring game
\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.lef
```\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\nclass Solution:\n    def btreeGameWinningMove(self, root: Optional[TreeNode], n: int, x: int) -> bool:\n        \n        node = None\n        queue = [root]\n        # find the node x\n        while queue:\n            node = queue.pop(0)\n            if node.val == x:\n                break\n            if node.left: queue.append(node.left)\n            if node.right: queue.append(node.right)\n        \n        def dfs(t):\n            if not t:\n                return 0\n            \n            return 1 + dfs(t.left) + dfs(t.right)\n        """\n        There are atmost 3 nodes connected to x: parent, left, right\n        As a blue player, you must block off the path that would give you\n        the maximum number of nodes to color.\n        """\n        l,r = dfs(node.left), dfs(node.right)\n        # num parents of x\n        p = n-1-l-r\n        \n        return l > p+r+1 or r > p+l+1 or p > l+r+1\n```
[]