C++ | Faster than 100% | Winning Strategy
Essentially, the (possible) winning strategy is to choose a neighbor node to color \'BLUE\'. This will block the \'RED\' player from moving into the part of the
Essentially, the (possible) winning strategy is to choose a neighbor node to color \'BLUE\'. This will block the \'RED\' player from moving into the part of the tree that has the most nodes. To this, the optimal \'BLUE\' (neighbor) node is the one that contains the most nodes. \n\n```\n    /* Pointer to \'RED\' node. */\n    TreeNode* RED = nullptr;\n    \n    /* Perform depth-first search of the tree. */\n    int dfs(TreeNode* node, int x) {\n        /* Reached a leaf node. */\n        if (node == nullptr) return 0;\n        \n        /* Reached the \'RED\' node. */\n        if (node->val == x) {\n            RED = node; /* Save the pointer. */\n            return 0;\n        }\n                \n        return 1 + dfs(node->left, x) + dfs(node->right, x);\n    }\n    \n    bool btreeGameWinningMove(TreeNode* root, int n, int x) {\n        \n        /* Boundary case. */\n        if (n <= 1) return false;\n        \n        /* Number of blue nodes based on move. */\n        int numBlueNodes = 0;\n        \n        /* Initialize the \'RED\' node. */\n        RED = root;\n        \n        /* Choose the parent node (if available). */\n        if (root->val != x) numBlueNodes = dfs(root, x);\n        if (numBlueNodes > (n/2)) return true;\n            \n        /* Choose the right child node (if available). */\n        numBlueNodes = dfs(RED->right, x);\n        if (numBlueNodes > (n/2)) return true;\n        \n        /* Choose the left child node (if available). */\n        numBlueNodes = dfs(RED->left, x);\n        if (numBlueNodes > (n/2)) return true;\n        \n        /* No winning moves. */\n        return false;\n        \n    }
['Depth-First Search', 'C']