Champagne Tower - Leetcode 799 - Python

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

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

  • @kelvinology4
    @kelvinology4 11 หลายเดือนก่อน +5

    highly recommend all of you to do leetcode 118 - 120 (neetcode has all explanation videos)
    the structure is pretty similar that all of them are dealing with triangles
    btw great explanation and your solutions always inspire me, thanks a lot🙏🏻

  • @bundiderp5109
    @bundiderp5109 11 หลายเดือนก่อน +10

    Great explanation as always. But I found the 44.5 overflow at 4:40 to be very confusing. I am pretty sure it should be 49.5 as 2x 49.5 = 99.

    • @NeetCodeIO
      @NeetCodeIO  11 หลายเดือนก่อน

      Yep, my math was way off, sorry about that!

  • @akash-kumar737
    @akash-kumar737 11 หลายเดือนก่อน +1

    I coded after following your explaination and my code is exactly similar. Thanks dude. I have recently started doing Leedcode daily for last 5 days.

  • @Harish-rz4gv
    @Harish-rz4gv 11 หลายเดือนก่อน +6

    Kinda Pascal's triangle

  • @il5083
    @il5083 11 หลายเดือนก่อน +1

    I was worrying about some champagne will reach the end first. Didn’t think of processing it row by row is possible. Great explanation, thanks!

  • @darkcaper703
    @darkcaper703 11 หลายเดือนก่อน +7

    847. Shortest Path Visiting All Nodes :(

    • @themagickalmagickman
      @themagickalmagickman 11 หลายเดือนก่อน

      bfs with bitmask instead of set. Look up how to do a bitmask, its actually surprisingly easy. The intuitive approach is to bfs because we want a shortest path, each bfs node will need to maintain a visited set though. Instead of an actual set, we use an integer bitmask. As you know, integers are represented as binary, ex: 00101. If we assign each node to a position in the binary representation, we can mark it visited by flipping the digit from 0 to 1. This yields a unique integer for each visited set. So If I want to mark the 0th node as visited my bitmask looks like this: 0001 (4 nodes total, 0,1,2,3). This yields the integer 1. Set the 0 and 3rd visited? 1001, int = 9.
      Here is the operation for setting a given bit as visited, bitmask |= (1

  • @tenzin8773
    @tenzin8773 10 หลายเดือนก่อน +1

    Don't think I'll ever be able to solve this in a real interview if I never did this question before :(

  • @user-sx7zc3ez4w
    @user-sx7zc3ez4w 11 หลายเดือนก่อน

    It's literally NEET CODE! Thank you

  • @J1MKAKA1N
    @J1MKAKA1N 11 หลายเดือนก่อน

    Simple and elegant, thanks for the effort! Keep it going :)

  • @memeproductions4182
    @memeproductions4182 11 หลายเดือนก่อน

    did the same, but i basically consider this a BFS where each row is a level of the tree

  • @anantom251
    @anantom251 11 หลายเดือนก่อน

    You are the saviour.

  • @boisaulit
    @boisaulit 5 หลายเดือนก่อน

    Genius.

  • @satviksrinivas8764
    @satviksrinivas8764 8 หลายเดือนก่อน

    If poured was fixed could there be a DP solution? I'm thinking along the lines that you would have a base case since you know the total amount of champagne.

  • @VidyaBhandary
    @VidyaBhandary 11 หลายเดือนก่อน

    Superb Explanation ...

  • @SD-vk3ko
    @SD-vk3ko 11 หลายเดือนก่อน

    Thanks lord, we have you!!🙂

  • @AmanRaj-yn5pj
    @AmanRaj-yn5pj 11 หลายเดือนก่อน

    nice way of explaining👍

  • @anshror2583
    @anshror2583 11 หลายเดือนก่อน +1

    Bro please upload leetcode video daily

  • @phpostrich
    @phpostrich 11 หลายเดือนก่อน

    another one already wowz

  • @phpostrich
    @phpostrich 11 หลายเดือนก่อน

    this one was pretty cool

  • @aazzrwadrf
    @aazzrwadrf 11 หลายเดือนก่อน +2

    pretty hard for a med

  • @StellasAdi18
    @StellasAdi18 11 หลายเดือนก่อน

    Guess you meant 49.5 and not 44.5 at 5.08 for 100 example.

  • @danielsun716
    @danielsun716 11 หลายเดือนก่อน

    looks like the dp problem

  • @SeanBow-fs7rj
    @SeanBow-fs7rj 11 หลายเดือนก่อน

    ebat' traxatel

  • @silent7152
    @silent7152 11 หลายเดือนก่อน

    i thought it was a dp problem

    • @haroldobasi2545
      @haroldobasi2545 11 หลายเดือนก่อน

      Same, spent forever trying to think of a base case. I guess sometimes the most straightforward solutions are the right ones

    • @MrKB_SSJ2
      @MrKB_SSJ2 11 หลายเดือนก่อน

      lol