C++ 100% faster
Just counting the nodes in the subtree rooted at x.\n\n/**\n * Definition for a binary tree node.\n *  * struct TreeNode {\n *     int val;\n *     TreeNode *le
Just counting the nodes in the subtree rooted at `x`.\n```\n/**\n * Definition for a binary tree node.\n *  * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode() : val(0), left(nullptr), right(nullptr) {}\n *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}\n * };\n */\nclass Solution {\nprivate:\n    int countNodes(TreeNode* node){\n        if(!node){\n            return 0;\n        }\n        return 1 + countNodes(node -> left) + countNodes(node -> right);\n    }\npublic:\n    bool btreeGameWinningMove(TreeNode* root, int n, int x) {\n        queue<TreeNode*> q;\n        q.push(root);\n        TreeNode* target;\n        while(!q.empty()){\n            TreeNode* node = q.front();\n            q.pop();\n            if(node -> val == x){\n                target = node;\n                while(q.size()){\n                    q.pop();\n                }\n                break;\n            }\n            if(node -> left) q.push(node -> left);\n            if(node -> right) q.push(node -> right);\n        }\n        \n        int left = countNodes(target -> left);\n        int right = countNodes(target -> right);\n        if(left + right + 1 <= n / 2){\n            return true;\n        }\n        \n        if(left > n / 2 || right > n / 2){\n            return true;\n        }\n        return false;\n        \n    }\n};\n```
['Breadth-First Search', 'Recursion', 'Queue', 'C']