Javascript Easy Solution With Clear Explanation [DFS]
Okay so the solution to this problem is that we can win on 2 conditions:\n If the player has chosen a node where entire sum of all the nodes in the subtree for 
Okay so the solution to this problem is that we can win on 2 conditions:\n* If the player has chosen a node where entire sum of all the nodes in the subtree for their chosen node is less than the sum of the remainder nodes, you will easily win in this case by choosing the parent node to their tree and cutting them off.\n* If the left or right subtree of the node they chose contains more nodes than the rest of the remainder nodes, you will then win by chosing the left or right child node and cutting them off.\n\nIf none of the above conditions are true, you return false.\n\n```\nvar btreeGameWinningMove = function(root, n, x) {\n    let queue = [root], parents = [];\n    let temp = root;\n\t\n\t// find the node that has be chosen using dfs\n    while(temp.val !== x) {\n        temp = queue.shift();\n        temp.left ? queue.push(temp.left) : null;\n        temp.right? queue.push(temp.right): null;\n    }\n    \n    // get the sum of all the nodes in the sub tree using dfs\n    let getSubtreeSum = (node) => {\n        if(!node) {\n            return 0;\n        }\n        let q = [node];\n        let sub, count = 0;\n        while(q.length) {\n            count++;\n            sub = q.shift();\n            sub.left ? q.push(sub.left) : null;\n            sub.right? q.push(sub.right): null;\n        }\n        return count;\n    }\n    \n\t// get the sums of both child trees\n    let leftSum = getSubtreeSum(temp.left), rightSum = getSubtreeSum(temp.right);\n    \n\t// if the sum of all the nodes in the tree that the other player picked can be cut off, and is less than\n\t// the remainder return true\n    if( n - (leftSum + rightSum + 1 ) > leftSum + rightSum + 1){\n        return true;\n    }\n    \n\t// If one of the child nodes presents itself as a larger tree than the remainder count of nodes return true\n    if(leftSum > n - leftSum || rightSum > n-rightSum) {\n        return true;\n    }\n    \n\t// return false if none of these conditions can be met\n    return false;\n    \n    \n};
['Depth-First Search', 'JavaScript']