Distribute Coins in Binary Tree - Leetcode 979 - Python

Поділитися
Вставка
  • Опубліковано 12 вер 2024

КОМЕНТАРІ • 27

  • @arihantsinghrana2173
    @arihantsinghrana2173 3 місяці тому +18

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

  • @tommyshelby6277
    @tommyshelby6277 3 місяці тому +37

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

  • @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!

  • @АлекСневар
    @АлекСневар 3 місяці тому +4

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

  • @impolitebigmac3044
    @impolitebigmac3044 3 місяці тому +36

    I hate leetcode

  • @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

  • @vedantjha2327
    @vedantjha2327 3 місяці тому

    Interesting question.

  • @chien-yuyeh9386
    @chien-yuyeh9386 3 місяці тому

    Thanks for sharing 🎉

  • @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)

  • @nikitathacker5096
    @nikitathacker5096 3 місяці тому

    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

  • @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

  • @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

  • @sivaramakrishnankn1721
    @sivaramakrishnankn1721 3 місяці тому +3

    boondhi laddoo gang represent

  • @staywithmeforever
    @staywithmeforever 3 місяці тому

    Double bfs?

  • @priyanshagarwal8490
    @priyanshagarwal8490 3 місяці тому

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

  • @kevinwang8632
    @kevinwang8632 3 місяці тому +1

    this one was hard

  • @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