cpp solution
//I will win the game when when I choose a node in neighbour of x that has maximum number of nodes so that i will have more nodes to color if l  is left  neighb
//I will win the game when when I choose a node in neighbour of x that has maximum number of nodes so that i will have more nodes to color if l  is left  neighbour , r is right neighbour and u is upper neighbour then either of the below three should be true l > r+u || r > l+u || u > l+r whichever is true we\'ll choose that neighbour otherwise we will loose the game\n\nRuntime: 4 ms, faster than 80.55% of C++ online submissions for Binary Tree Coloring Game.\nMemory Usage: 10.9 MB, less than 100.00% of C++ online submissions for Binary Tree Coloring Game.\n```\nclass Solution {\n    int count(TreeNode* root){\n        if(!root){\n            return 0;\n        }\n        return 1+count(root->left)+count(root->right);\n    }\n    TreeNode* find(TreeNode* root, int x){\n        if(!root){\n            return NULL;\n        }\n        if(root->val == x){\n            return root;\n        }\n      TreeNode * left = find(root->left,x);\n      if(left == NULL){\n          return find(root->right, x);\n      } \n        return left;\n    }\npublic:\n    bool btreeGameWinningMove(TreeNode* root, int n, int x) {\n        int total = count(root);\n        TreeNode* red = find(root,x);\n        if(red == NULL){\n            return true;\n        }\n        int left = count(red->left);\n        int right = count(red->right);\n        int up = n - left - right - 1;\n        if((up > left + right) || (left > up + right) || (right > up + left)){\n            return true;\n        }\n        return false;\n    }\n};
[]