Distribute Coins in Binary Tree - Leetcode 979 - Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ส.ค. 2024

ความคิดเห็น • 27

  • @tommyshelby6277
    @tommyshelby6277 3 หลายเดือนก่อน +37

    bro sneaked in `ladoos` and thought we wouldn't notice😂?

  • @arihantsinghrana2173
    @arihantsinghrana2173 3 หลายเดือนก่อน +18

    Thank you soo much for making these video and soo early as well!!!

  • @weens571
    @weens571 3 หลายเดือนก่อน +4

    Just when I needed the video. Thanks. 😁

  • @aashishbathe
    @aashishbathe 3 หลายเดือนก่อน +7

    LADDOOO AGAINNN. Just remembering that, I just had it yesterday and it was great!

  • @user-he4st2ro5h
    @user-he4st2ro5h 3 หลายเดือนก่อน +4

    Actually, the second solution with one variable is much easier to understand imho.

  • @HimanshuSaini-ur6by
    @HimanshuSaini-ur6by 3 หลายเดือนก่อน

    This was great..by 9 minute mark I got an idea and coded it out. it workedd

  • @MP-ny3ep
    @MP-ny3ep 3 หลายเดือนก่อน

    Great explanation as always. Thank you

  • @shashwatsingh9247
    @shashwatsingh9247 3 หลายเดือนก่อน

    Tough ques. thanks neetcode

  • @impolitebigmac3044
    @impolitebigmac3044 3 หลายเดือนก่อน +36

    I hate leetcode

  • @vedantjha2327
    @vedantjha2327 3 หลายเดือนก่อน

    Interesting question.

  • @chien-yuyeh9386
    @chien-yuyeh9386 3 หลายเดือนก่อน

    Thanks for sharing 🎉

  • @kwakukusi4094
    @kwakukusi4094 3 หลายเดือนก่อน

    best explanation

  • @pastori2672
    @pastori2672 3 หลายเดือนก่อน +1

    i actually struggled so much on this one and i thought your gonna clown them for the difficulty again but i guess not

  • @shivangikhemka4379
    @shivangikhemka4379 3 หลายเดือนก่อน

    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)

  • @sivaramakrishnankn1721
    @sivaramakrishnankn1721 3 หลายเดือนก่อน +3

    boondhi laddoo gang represent

  • @nikitathacker5096
    @nikitathacker5096 2 หลายเดือนก่อน

    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

  • @priyanshagarwal8490
    @priyanshagarwal8490 3 หลายเดือนก่อน

    2055. Plates Between Candles... Next Please..🙏

  • @kevinwang8632
    @kevinwang8632 3 หลายเดือนก่อน +1

    this one was hard

  • @staywithmeforever
    @staywithmeforever 3 หลายเดือนก่อน

    Double bfs?

  • @sajankumarrajbanshi1158
    @sajankumarrajbanshi1158 3 หลายเดือนก่อน

    i love ladoos

  • @vijayanks1714
    @vijayanks1714 3 หลายเดือนก่อน

    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

  • @Masterasadumar
    @Masterasadumar 3 หลายเดือนก่อน +2

    lol ladu

  • @sankhadip_roy
    @sankhadip_roy 3 หลายเดือนก่อน

    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