Interview Question: 2 eggs 100 floors

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

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

  • @MunkyChunk
    @MunkyChunk 5 ปีที่แล้ว

    This is a great explanation for someone who already has some idea of what's going on, but not so much for a complete noobie I don't think.

  • @naveenbythepowerofra
    @naveenbythepowerofra 8 ปีที่แล้ว +3

    Could you please explain why you have considered the difference as 1? why not N, N-2, N-4,... or N, N-3, N-6....

    • @AK43ver
      @AK43ver 6 ปีที่แล้ว

      Naveen I'm guessing you'll be skipping a floors

  • @LM0nst3R
    @LM0nst3R 7 ปีที่แล้ว

    Great explanation ! It would be even more interesting to continue on with determining a formula to calculate n directly from N (100 in this example). And a little quadratic equations magic would yield the following :
    n = ceil(√(2N + 1/4) - 1/2)

  • @yolob2116
    @yolob2116 8 ปีที่แล้ว +1

    why don't we decrease the separators by 2
    eg for the total 10 floors
    first go 6 floors high
    next go 4 floors high

    • @AK43ver
      @AK43ver 6 ปีที่แล้ว

      yolob 21 only have 2 eggs you'll be skipping floors

  • @verticalthinking1
    @verticalthinking1 9 ปีที่แล้ว

    Thank you. Way to use your knowledge to help the world.

  • @pragyAnsh4ever
    @pragyAnsh4ever 5 ปีที่แล้ว

    best explanation finally...Thanks for all your efforts

  • @maqboolahmed6451
    @maqboolahmed6451 6 ปีที่แล้ว

    Considering 10 floors & 2 eggs, what if it breaks at 4th floor, the next check would be at 3rd floor and if it breaks there as well?

  • @Hoodratliker
    @Hoodratliker 6 ปีที่แล้ว

    If you only have 2 eggs. How can you possible ever find out where the threshold is on 2 tries

  • @sreeparnabasak5313
    @sreeparnabasak5313 7 ปีที่แล้ว

    your explanation was perfect for anyone to understand but please make it brief

  • @MhZnSO4
    @MhZnSO4 7 ปีที่แล้ว

    Thanks to you! Finally understood this weird puzzle

  • @justpk5773
    @justpk5773 8 ปีที่แล้ว

    what if u failed on the first try i.e, on 14th floor the egg broke?

    • @PaulSchwarz1983
      @PaulSchwarz1983 8 ปีที่แล้ว

      +Just PK then your first egg is broken and you enter the second phase of the algorithm which is a linear search from 0 to 13 using the second egg, this is O(n). The first egg enjoys an O(logN) runtime. So if the egg broke on the 14th floor (first iteration of the first algorithm) then you've identified the worst case scenario and the work done between the two eggs is the most unbalanced.

  • @QuanMa
    @QuanMa 6 ปีที่แล้ว

    what about 3 eggs instead of 2

  • @VladimirDjokic
    @VladimirDjokic 6 ปีที่แล้ว

    Great explanation. Thank you!

  • @shivakshisinghal9751
    @shivakshisinghal9751 9 ปีที่แล้ว

    finally understood the problem.. keep up the good work (y)

  • @googlable
    @googlable 6 ปีที่แล้ว

    Great video!
    What if you have K eggs?

    • @googlable
      @googlable 6 ปีที่แล้ว

      I think in this case you would divide each interval another K-1 times?
      For example 100 separates to |14 | |+13 | |+12 |... then you divide the |14| section to smaller sections such as n(n-1)/2>=14 and so on...

  • @ownagejuice1394
    @ownagejuice1394 5 ปีที่แล้ว +1

    skip to @10:00

    • @stevejobs5919
      @stevejobs5919 4 ปีที่แล้ว

      the way he belabored the explanation man hahahaha, it's like trying to defocate with a big constipated poop

  • @sindhujac
    @sindhujac 8 ปีที่แล้ว

    Real good explanation !!

  • @deepanshukapoor
    @deepanshukapoor 8 ปีที่แล้ว

    what if there are n eggs and n floors???

  • @vanillangela
    @vanillangela 7 ปีที่แล้ว

    i still do not understand, why as the floor number increases, we want to decrease the number of times we use egg 2 (as well as the # of floors going up smaller)? at video 9:34. can someone please help? :(

  • @anantthebiker
    @anantthebiker 8 ปีที่แล้ว

    amazing explanation ... I seldom write comments under a video . :) keep it up .

  • @reyou7
    @reyou7 3 ปีที่แล้ว

    eggazing!

  • @samsherverma9737
    @samsherverma9737 5 ปีที่แล้ว

    Nice explanation...

  • @biteshtiwari
    @biteshtiwari 10 ปีที่แล้ว +3

    nice explanation.
    would be better if short videos.

    • @AppleJuiceTeaching
      @AppleJuiceTeaching  10 ปีที่แล้ว +2

      Your right! I will try to correct that mistake In the future to increase my retention time and not be a bore.

  • @YaskSrivastava
    @YaskSrivastava 9 ปีที่แล้ว

    Awesome explanation , do more (y)

  • @shutzopia
    @shutzopia 9 ปีที่แล้ว

    great explanation

  • @HIMANSHUTANDASI
    @HIMANSHUTANDASI 7 ปีที่แล้ว

    nyc explanation.

  • @CHANDANKUMAR-jz1eg
    @CHANDANKUMAR-jz1eg 8 ปีที่แล้ว

    Good explanation but little boring