Hey, How would be solve this to get minimum number of moves if we had more total coins than number of total nodes? total coins > total nodes (Extended problem)
extra = left_extra+right_extra+1-node.val # calculated it from the first solution equations extra = left_extra+right_extra-1+node.val # provided by neetcode both is working don't know how
Thank you soo much for making these video and soo early as well!!!
bro sneaked in `ladoos` and thought we wouldn't notice😂?
Just when I needed the video. Thanks. 😁
LADDOOO AGAINNN. Just remembering that, I just had it yesterday and it was great!
Actually, the second solution with one variable is much easier to understand imho.
I hate leetcode
This was great..by 9 minute mark I got an idea and coded it out. it workedd
Great explanation as always. Thank you
Tough ques. thanks neetcode
Interesting question.
Thanks for sharing 🎉
Hey, How would be solve this to get minimum number of moves if we had more total coins than number of total nodes?
total coins > total nodes
(Extended problem)
How can we conclude that this question doesnt require DP? At first glance, we have choices and we need minimum, making it a good candidate for DP
best explanation
i actually struggled so much on this one and i thought your gonna clown them for the difficulty again but i guess not
extra = left_extra+right_extra+1-node.val # calculated it from the first solution equations
extra = left_extra+right_extra-1+node.val # provided by neetcode
both is working don't know how
boondhi laddoo gang represent
Double bfs?
2055. Plates Between Candles... Next Please..🙏
this one was hard
i love ladoos
public int[] dfs(TreeNode root){
if(root == null) return new int[]{0,0}; //size, coins
int[] left = dfs(root.left);
int[] right = dfs(root.right);
int[] curr = new int[]{left[0]+right[0]+1, left[1]+right[1]+root.val};
res += Math.abs(curr[0] - curr[1]);
return curr;
}
java code
lol ladu