Egg Dropping Problem: Dynamic Programming Fundamentals & Understanding Subproblem Decomposition

Поделиться
HTML-код
  • Опубликовано: 14 янв 2025

Комментарии • 459

  • @BackToBackSWE
    @BackToBackSWE  5 лет назад +36

    Table of Contents:
    Intro 0:00 - 0:24
    The Problem Introduction 0:24 - 2:39
    Base Case #1: 1 Egg 2:39 - 6:21
    Base Case #2: 0 or 1 Floors 6:21 - 8:47
    Summarizing Our Base Cases 8:47 - 10:18
    The Simulation. 6 Floors, 3 Eggs 10:18 - 18:36
    DP Table Walkthrough 18:36 - 22:06
    Camera Dies. Finishing Explanation of The Simulation. 22:06 - 23:30
    Time Complexity 23:30 - 24:12
    Space Complexity 24:12 - 24:51
    Wrap Up 24:51 - 25:19
    Update 4/3/19: Both the Top Down & Bottom Up approaches shown in the video time out on Leetcode due to the test cases changing.
    The code for the problem is in the description (both bottom up and top down). Fully commented for understanding.

    • @fpv_am
      @fpv_am 5 лет назад +7

      Bro, just, aaaaaaaaaaaaaaaaaaah, just, aaaaaaaaaaaaaaaaaa, just, I applause you, thank youuuuuuuuuuuuuuuuuuuuuuu, brooo, I just cant express my feelings, aaaaaaa its so coooooooooooooool, I understood it!

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      yeah

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +1

      hahahaha nice

    • @monil1601
      @monil1601 5 лет назад +1

      Yep, I got that but what's the recurrence relation for construction of the DP table?
      If we denote optimal solution by OPT(m,n) where we have m eggs and n floors then how will we write it in terms of recurrence ?

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      @@monil1601 I don't remember

  • @ahmedboutaraa8771
    @ahmedboutaraa8771 4 года назад +44

    your channel is like a NETFLIX of DS & algorithms.
    whenever i try to watch one of your videos i found 10 more intriguing ones

  • @chanman123
    @chanman123 5 лет назад +67

    Just wanted to say how much I appreciate these videos. You're really doing a great job of helping all of us out here and I can't thank you enough!

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +22

      I have to feed the family. Everyone eats. Otherwise, I'm starving.

  • @airysm
    @airysm 5 лет назад +154

    These are some strong ass eggs

  • @chaitanyapvs4150
    @chaitanyapvs4150 5 лет назад +7

    Its nice to find a video explaining way of approach rather than repeating the dp tables from solutions.Thanks man.

  • @cautioni
    @cautioni 3 года назад +2

    where is the link to your code?

  • @kuralamuthankathirvelan
    @kuralamuthankathirvelan 5 лет назад +140

    One
    (Back To Back SWE)
    video per day keeps tushar roy away !🤣🤣🤣

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +16

      hahaha CALM DOWN

    • @karthikrangaraju9421
      @karthikrangaraju9421 4 года назад +16

      Respect for both, for the lack of good dynamic programming videos, Tushar pioneered it well imo. Ben is teaching it better with the intuition behind things, can’t deny that either :)

    • @anunaysharma2718
      @anunaysharma2718 4 года назад

      @@abhimishra2276 what's wrong with them?

    • @ritwik121
      @ritwik121 3 года назад

      @@abhimishra2276 abdul bari is good

    • @abhimishra2276
      @abhimishra2276 3 года назад +1

      @@ritwik121 yes bro i was so wrong he is amazing

  • @studgaming6160
    @studgaming6160 5 лет назад +7

    I have watched several videos but none of them was as good as this one. Awesome job dude. Thank U. All the videos talk about solution without explaining subproblems of dynamic programming. But you explained it really well my friend.

  • @chetansahu1505
    @chetansahu1505 5 лет назад +6

    You are the best mentor that I've ever seen in my life. You can even make a fool understand the complex concepts. (y) keep up the work bro :)

  • @rakeshsinha9541
    @rakeshsinha9541 5 лет назад +8

    I Really like the way how you're explaining the problem thoroughly

  • @norbertnemesh
    @norbertnemesh 3 года назад +1

    Replace egg with ball and this video becomes much more fun to watch

  • @aaryangupta1689
    @aaryangupta1689 4 года назад +1

    where is the link for the code it not in description.

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated - we only maintain backtobackswe.com now.

  • @shashikantpunia9019
    @shashikantpunia9019 4 года назад +3

    how easily i understood that tough problem signifies that level of teaching of ben...he has fabulous teaching skills.

  • @krishnakrmahto97
    @krishnakrmahto97 5 лет назад +9

    I can see the amount of effort you've been putting on your videos. This is what I had been looking for the last 2 years. I feel very lucky that you started making videos before I graduate.

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +1

      dang...that's a long search hahaha, and thanks haha...more are a comin'

    • @krishnakrmahto97
      @krishnakrmahto97 5 лет назад +1

      @@BackToBackSWE looking forward to all of 'em!

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +1

      @@krishnakrmahto97 nice

  • @meemee417
    @meemee417 2 месяца назад

    cant believe it took me this long to just realize that its just break and not break on every floor lol. this video helped me pull the pieces together

  • @dongshuowu3454
    @dongshuowu3454 5 лет назад +4

    I couldn't believe this amazing channel only has 13K subs.

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +1

      Aw, thanks. I work pretty hard on this. I hope it grows. I've put my life into this.

    • @bddyonetim539
      @bddyonetim539 5 лет назад

      @@BackToBackSWE It is the greatest channel that I have found out...Thanks a lot...

  • @hamidurrahman3183
    @hamidurrahman3183 5 лет назад +2

    Thank you, Lord. Finally found a video that can help. I wish I had this person teaching my algorithm class instead of my prof who looks at her notes and talks to the board.

  • @tanvirarjel
    @tanvirarjel 2 года назад +1

    One of the best explanations for this problem on the internet. ❤

  • @vaibhavsinha2728
    @vaibhavsinha2728 3 года назад +2

    Where is the code , please help me to find it...

  • @bharathjain2633
    @bharathjain2633 4 года назад +1

    where is the code in the description?

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated - we only maintain backtobackswe.com now.

  • @techbarikcom
    @techbarikcom 7 месяцев назад +1

    The code never in the description 😁

  • @overclockinggames2419
    @overclockinggames2419 4 года назад +11

    I want to see you and Tushar in one frame 😂. Anyways amazing explanation as always .

  • @martinberridge9173
    @martinberridge9173 4 года назад +1

    These videos are the best I've seen on algorithms/problem solving on RUclips. Not code walkthroughs or dry mathematical proofs just the facts!

  • @zehrasubas9768
    @zehrasubas9768 5 лет назад +2

    Watched so many videos about this problem and got confused, this video made everything clear!

  • @erichlf
    @erichlf 5 лет назад +2

    By far the best explanation of the egg drop problem I have come across.

  • @akshatsamdani
    @akshatsamdani Год назад +1

    Can't find the code in the description. Also, not available on the site. :(

  • @UnseenVivekC
    @UnseenVivekC 5 лет назад +2

    I have been trying to understand this problem through many YoutTubers,but lemme tell you Sir, this is the best explanation I had. Keep the work up Sir.

  • @raymondyoo5461
    @raymondyoo5461 5 лет назад +9

    When the egg doesn’t break, why do we go for [ totalfloor - simfloor ] instead of [ simfloor + 1 ] ???

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +12

      It expresses the # of floors above where we dropped. Think on this.
      Example 1:
      6
      5
      4
      3 (drop here)
      2
      1
      0
      simFloor = 3
      I drop at 3. No break. I go up. Do I have 6 - (3) = 3 floors above me?
      Or simfloor + 1 = (3) + 1 = 4 floors above me?
      Example 2:
      6 (drop here)
      5
      4
      3
      2
      1
      0
      simFloor = 6
      I drop at 6. No break. I go up. Do I have 6 - (6) = 0 floors above me?
      Or simfloor + 1 = (6) + 1 = 7 floors above me?
      Check the code in the description. Really internalize it.

    • @raymondyoo5461
      @raymondyoo5461 5 лет назад +2

      Hmm... interesting. Thank you very much for your explanation :)

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +1

      @@raymondyoo5461 I think I could've done better with this, oh well. Just keep thinking on it if you still don't 100% understand it.

    • @raymondyoo5461
      @raymondyoo5461 5 лет назад +2

      @@BackToBackSWE Yeah, I searched other videos or blogs, and I just saw 99% similar explanation to yours. I hope I can come back here later and I clearly understand this.

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      @@raymondyoo5461 Yeah, time helps as you see more dp problems. It is a specific way of thinking. When it does click it will be interesting.
      What is still unclear? If I may clarify it.

  • @avishekdutta1901
    @avishekdutta1901 4 года назад +1

    Sir i cannot find the code!!!Help me out!!!!

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated - we only maintain backtobackswe.com now.

  • @MyGroo
    @MyGroo 4 года назад +1

    The diagram starting at 12:52 was a bit misguiding the first time I saw it, because the first 6 tree levels don't represent the same thing as the second pairs of "possibilities". In reality, the solution for just one of the subproblems (e.g. 5F, 3E in this list) needs to iterate again through simulations for all 5 floors (with both break/non-break possibilities). And then each of those smaller subproblems again needs to iterate through a bunch of floor-egg pairs. This is where the (F, E) pairs begin reappearing and the memoization (caching) of the subproblems leads to DP.
    One useful way of looking at it is to realize that the solution to (4F, 3F) is the same regardless of whether we are considering top 4 floors or bottom 4 floors - it doesn't matter and we will end up calculating them twice unless we cache them or use DP to get them ahead of time.

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      Hey - I dont remember this problem enough to answer this, shot this a while back

  • @markfishman5242
    @markfishman5242 5 лет назад +5

    good video. I was with you until min 20:47. Why do you have drop (2,1) in addition to drop (2,2). I get the 2,2 one, but since 2 eggs,1 floor cell was a 1, why that one ?

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      I fudged making that part clear - I remember this vividly, I'd go in and explain but I'm rapid fire responding to 250 comments I got backed up after 2 weeks

    • @jomosis9234
      @jomosis9234 5 лет назад +1

      In the case (2,1), you are on the Floor 1,just by using one egg, you would know which floor is the "won't break"(I will use F below) floor. If the egg breaks on Floor 1, then "F" floor will be Floor 0. Otherwise will be Floor 1. Only Floor 1 and Floor 0 are to be discussed in case(2,1). totalFloor = 1 is a base case, no matter how many eggs there are, the answer is always 1.

  • @ChainForLife
    @ChainForLife 5 лет назад +7

    Hey great video, just a quick question, why is it that the minimum amount of egg drops for n floors is n? Wouldn't it be log(n) times since we can do sort of a binary search where we drop an egg from (n/2)th floor and if it breaks we know every egg dropped from above that floor will break and if it doesn't break we know that every egg dropped from below that floor won't break ?

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +1

      We can do it logarithmically, that is the next best solution. I just presented the base solution that someone could practically come up with in an interview.

    • @ChainForLife
      @ChainForLife 5 лет назад +1

      @@BackToBackSWE I see. Can I ask you just one more question? Why is it that we want the worst outcome of the drops, that is max(drop(eggs, totalFloor - currentFloor), drop(eggs - 1, currentFloor - 1)) ? This part still doesn't seem to click in my head.

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +3

      @@ChainForLife Never limit questions. Always ask questions until you understand. Push the teacher as well as yourself because I don't know it all...or else we both learn nothing.
      So think about this....our goal is to tell the caller the SMALLEST amount of drops so that I can PROMISE that in those drops...I will find the pivotal floor. If I don't account for the worst outcome of drops...I could be lying...my promise could be broken.
      I have to take into account the WORST outcome and BOUND my drops to that because it promises that I find the pivotal floor in that amount of drops NO MATTER WHAT CASE happens. Does that make sense?

    • @ChainForLife
      @ChainForLife 5 лет назад +1

      @@BackToBackSWE Yes sir, that last sentence pretty much made it crystal clear for me.

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +1

      @@ChainForLife Ok, cool, haha don't "sir" me...I'm just a dude...a normal guy.

  • @trejojimenezabiud5271
    @trejojimenezabiud5271 Год назад +1

    where i can find the code ?

  • @tastypie2276
    @tastypie2276 Год назад

    Sir, you're one of the best algorithm teachers I've ever seen! Your explanations are really fascinating!

    • @BackToBackSWE
      @BackToBackSWE  Год назад

      Thank you, appreciate it 😄 Also check out our Free 5 Day DSA Interview Prep Mini-Course - backtobackswe.com/ 🎉

  • @matthewbuchholz5251
    @matthewbuchholz5251 4 года назад +4

    I know this would be a difficult one to make, but you should make a video going over techniques for identifying overlapping subproblems and optimal substructure in DP problems in general. Pulling from examples like this and longest non-decreasing subsequence (and your other vids). Basically, abstracting the problem specific examples and giving some practical tips for how to identify subproblems.
    Fingers crossed xD

  • @anushayerram772
    @anushayerram772 Год назад

    There is no link for the code in the description !!!!!!!!

  • @al-farouksaleh2144
    @al-farouksaleh2144 4 года назад +7

    Where are the codes dude, we really need them.
    Ps: you’re a life saver, keep going ✌🏻💙

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      thanks and we only maintain code on backtobackswe.com

    • @rashim
      @rashim 4 года назад +3

      Here's the code link:
      ruclips.net/user/redirect?q=https%3A%2F%2Fgithub.com%2Fbephrem1%2Fbacktobackswe%2Ftree%2Fmaster%2FDynamic%2520Programming%252C%2520Recursion%252C%2520%2526%2520Backtracking%2FEggDrop&redir_token=QUFFLUhqbnQ3T2tXamxoVTh5c205TlJCYjZCYmZsOWNjZ3xBQ3Jtc0trODRCQlRicjVIbXh0dXk5VEhrel9QQkZUNXFRamMzSVdablYxLUE5aVk3RGxrRUFOMjNTQkRWSk1qeFlrcVk1cEVIUU51b3E5X3dtSXh2M0FGcmxPY0ZiUFU5eTU4YjhuMDZYckl3YXNDeTQ2UFJIQQ%3D%3D&event=comments&stzid=UgzKhQ0U7vTf35sZifd4AaABAg

  • @amartyamishra6961
    @amartyamishra6961 8 месяцев назад

    Where is the code? Am I mistaking the place where the description is supposed to be?

  • @allezzthepunk
    @allezzthepunk 4 года назад

    I am almost in tears for how good this is explained

  • @animeshkumar1201
    @animeshkumar1201 4 года назад +2

    Dude where is the code? I couldn't find.

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated - we only maintain backtobackswe.com now.

    • @rashim
      @rashim 4 года назад +2

      Here is the code
      ruclips.net/user/redirect?q=https%3A%2F%2Fgithub.com%2Fbephrem1%2Fbacktobackswe%2Ftree%2Fmaster%2FDynamic%2520Programming%252C%2520Recursion%252C%2520%2526%2520Backtracking%2FEggDrop&redir_token=QUFFLUhqbnQ3T2tXamxoVTh5c205TlJCYjZCYmZsOWNjZ3xBQ3Jtc0trODRCQlRicjVIbXh0dXk5VEhrel9QQkZUNXFRamMzSVdablYxLUE5aVk3RGxrRUFOMjNTQkRWSk1qeFlrcVk1cEVIUU51b3E5X3dtSXh2M0FGcmxPY0ZiUFU5eTU4YjhuMDZYckl3YXNDeTQ2UFJIQQ%3D%3D&event=comments&stzid=UgzKhQ0U7vTf35sZifd4AaABAg

  • @MMOlocation
    @MMOlocation 5 лет назад +2

    Thank you so much for your effort. You can't even imagine how much these help.

  • @sahsubodh
    @sahsubodh 5 лет назад +1

    not sure if you will see this but the link for code is broken here.

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +1

      I see every comment and I dont have time to fix it. I restructured the repo

  • @amanpratapsingh1243
    @amanpratapsingh1243 4 года назад +1

    i can't find the code for the problem!!! please help...

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated, we only maintain backtobackswe.com now.

  • @aamirjamal6833
    @aamirjamal6833 5 лет назад +3

    These have to be some hard ass eggs man.. Thanks for the lucid explanation bro..

  • @anyadavidovich1083
    @anyadavidovich1083 4 года назад +4

    code is gone -- can you please re upload it? :)

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      ok

    • @rashim
      @rashim 4 года назад +1

      Here's the code link:
      github.com/bephrem1/backtobackswe/tree/master/Dynamic%20Programming%2C%20Recursion%2C%20%26%20Backtracking/EggDrop

  • @hoelefouk
    @hoelefouk 5 лет назад +2

    Keep up the good work and keep making our life easier!!

  • @Ashish-_-
    @Ashish-_- 5 лет назад +4

    I want to thank you sir for you really put in so much effort into these videos.I like the fact that you provide links to other channels too ( Like Tushar Roy etc).

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +2

      yeah haha, this is meant to be a resource of many

  • @sahilk335
    @sahilk335 5 лет назад +2

    At 20:59
    When we want value for drop(2,2) ,
    then,
    Why do we simulate sim(2,1) & sim(2,2) .
    we are solving for is 2 (which is 'totalFloors') floors and 2 (which is 'totalEggs') eggs. We are doing 2 simulations: sim(2, 1) (2 eggs, start from floor 1) and sim(2, 2) (2 eggs, start from floor 2).
    why not just sim(2,1) ?
    beacuse sim(2,2) is bad choice... right ?

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +1

      "why not just sim(2,1)?" If we just do one of the simulations (and not all of them) we may miss a case that would've yielded a truer bound to the worst amount of eggs that would need to be dropped to ensure we find the pivotal floor. For the approach in the video (and it is not the most optimal approach), we have to run all simulations to ensure our upper limit is correct with such a guarantee.

  • @varunagarwal5189
    @varunagarwal5189 4 года назад +1

    best explanation to this problem so far

  • @priyanktewari8841
    @priyanktewari8841 5 лет назад +5

    Too good bro! Dead camera was a bummer but great explanation!

  • @sauravdas7591
    @sauravdas7591 4 года назад +2

    why is it that we take the min of WORST CASE? what does WORST CASE represents here? The Maximum no of attempts that you can do at given floor without breaking the egg

    • @BackToBackSWE
      @BackToBackSWE  4 года назад +1

      The worst-case can happen so we must account for it. We want to know the best we can do given the worst case.

  • @shubhamdubey2283
    @shubhamdubey2283 5 лет назад

    at 20:50 You said that the answer is the one who do the worst but I think it minimum of "all the worst case possibilities at each floor" for a corresponding (eggs and floors)

  • @raymondyoo5461
    @raymondyoo5461 5 лет назад +2

    I know you have your own plan, but I have a suggestion.
    Recently I started learning 'parametric search' and I find it tricky.
    -> what is the proper condition to be put in "while( )" ???
    -> when do I put '=' on "if (K < mid)", and when do I put '=' on "if (mid < K)" ???
    I don't wanna break your pace, just wanted to give you an idea. thx!

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      Not familiar with parametric search. Is it related to binary search?

    • @raymondyoo5461
      @raymondyoo5461 5 лет назад

      @@BackToBackSWE I heard it is highly relevant to binary search. I found some example questions, I'll add the links here.
      Question 1 ) hsin.hr/coci/archive/2011_2012/contest5_tasks.pdf -- Question #2 (It starts with the sentence "Lumberjack Mirko needs to chop down M metres of wood....")
      Question 2 ) www.acmicpc.net/problem/3703
      Question 3 ) poj.org/problem?id=3273
      I think I can solve above questions applying binary search... Do you agree? Or any better method to solve them???

  • @maruthiteja2586
    @maruthiteja2586 4 года назад +1

    Where is the code

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated - we only maintain backtobackswe.com now.

    • @maruthiteja2586
      @maruthiteja2586 4 года назад

      @@BackToBackSWE then how to see the code

    • @maruthiteja2586
      @maruthiteja2586 4 года назад

      you have mentioned three to four times in the video that code is available in the description.It will more helpful if you provide code.

  • @cristianouzumaki2455
    @cristianouzumaki2455 4 года назад +3

    after watching several videos on this topic, this video proved out to be the best as always. explanations were very clear although the hiccup in the end disrupted the flow.

  • @ruchadeodhar1708
    @ruchadeodhar1708 5 лет назад +4

    Awesome explanation !! Thank you so so much!

  • @anmoljhanwar5843
    @anmoljhanwar5843 4 года назад

    I am unable to find the implemented code in description .Where should i be looking?

  • @ankitgoyal8556
    @ankitgoyal8556 9 месяцев назад +1

    I don't where you are these days, when I was fresher I learnt from your videos.
    Now I have experience of 3 years and I am still learning from you.
    Am I in love with you ?
    😜

  • @ashishkumarchoubey5592
    @ashishkumarchoubey5592 3 года назад

    I never am able to find code in description.

  • @anirudhsingle
    @anirudhsingle 4 года назад +1

    The code link does not work anymore

  • @anuragkarwa931
    @anuragkarwa931 4 года назад +1

    where is the code for this problem

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repsoitory is deprecated - we only maintain backtobackswe.com now.

  • @tejasghone5118
    @tejasghone5118 4 года назад +1

    Great clarification of the problem!! This was my 3rd vdeo for the egg problem and now i am satisfied!

  • @ayanbizz
    @ayanbizz 4 года назад +1

    Thanks for the explanation. But the github link is not working.

  • @prabhpreetsingh5341
    @prabhpreetsingh5341 4 года назад +3

    Its my first time watching your video and I gotta tell it "MAN U HAVE EARNED MY RESPECT" seriously man can just emphazize on how much easy u did this to me . .
    Just a single problem ... ur code link redirects to a page not found ... look up for that

  • @thanga2317
    @thanga2317 3 года назад

    Thanks for the detailed explanation :
    // if egg breaks then egg-1 and floor -1 ==> dp[e - 1][k - 1]
    // else no change in egg count and remaining floors which is f-k ==> dp[e][f - k]
    // k means which floor we are in -- > first floor , second floor
    // 2 Eggs -> 3 Floors
    // • 2 Eggs -> lets try from 1st Floor-> 1,0 ,, 2,2
    // • 2 Eggs -> lets try from 2nd Floor -> 1,1 ,, 2,1
    // 2 Eggs -> lets try from 3rd Floor -> 1,2 ,, 2,0

  • @Pickyricky69420
    @Pickyricky69420 4 года назад

    My GUY!!! You are brilliant! I will invest my tuition to a service you provide. Take my money!

  • @caseyschneider1974
    @caseyschneider1974 5 лет назад +1

    What would the complete dynamic programming table look like in the example?

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      it is filled out in the video?

    • @caseyschneider1974
      @caseyschneider1974 5 лет назад

      Back To Back SWE your camera dies at 22:06 before you’re able to finish filling out the last 6 cells

  • @codetolive27
    @codetolive27 5 лет назад +1

    It's very clear that you have put in a lot of effort to come up detailed explanation. Thank you keep up the good work.

  • @ShaliniNegi24
    @ShaliniNegi24 4 года назад +2

    One of the best explanation.
    Thank you, sir!

  • @jomosis9234
    @jomosis9234 5 лет назад +1

    Thanks for your perfect explanation!But for your code, I have one question. Why do you plus one here " int accountingForDroppingAtThisSubproblem = 1 + costOfWorstOutcome;" You mentioned that you were doing a test.Can you explain the test clearly?I'm feeling quite confused.

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      The +1 denotes dropping an egg then solving the remaining subproblems passing the resulting state change to the next call

    • @jomosis9234
      @jomosis9234 5 лет назад +1

      @@BackToBackSWE Thx!

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      @@jomosis9234 sure

  • @palashkamble2325
    @palashkamble2325 4 года назад +2

    Hey, can you make a video for O(K*log N) approach?

    • @BackToBackSWE
      @BackToBackSWE  4 года назад +1

      Right now cannot but would if I had the time

  • @aneeshmv8201
    @aneeshmv8201 4 года назад +1

    Where is the code(solution)? I can't find it in the description box

    • @BackToBackSWE
      @BackToBackSWE  4 года назад +2

      link is gone - repo is no longer maintained but it is on my github

    • @aneeshmv8201
      @aneeshmv8201 4 года назад

      @@BackToBackSWE Can you cover more DP problems? Especially the ones in Tushar's playlist? Interview season is around the corner, please more DP, please. Thankyou for great content. Respect from India.

  • @lakshyakhera
    @lakshyakhera 4 года назад +1

    I can't find link to code. :((

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated - we only maintain backtobackswe.com now.

  • @kdvr60
    @kdvr60 4 года назад +1

    I can't find the code in the description.

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated - we only maintain backtobackswe.com now.

  • @rollinOnCode
    @rollinOnCode 3 года назад

    Where is the link to the code?

  • @demidrek-heyward
    @demidrek-heyward 4 года назад +1

    You always say that the code is in the description but I never see it? Did this get moved to your subscription service? Either way thanks!

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      Hey, we had a public repository and we have deprecated it and only maintain backtobackswe.com from now on

    • @dnield
      @dnield 4 года назад +1

      unsubscribed

    • @demidrek-heyward
      @demidrek-heyward 4 года назад

      @@BackToBackSWE okay gotcha i found it and thanks again!

  • @Dal.alef.
    @Dal.alef. 4 года назад +1

    Watched it while on the treadmill, nicely explained, just wish your cam didn't die

  • @anaghtelluri
    @anaghtelluri 5 лет назад +1

    Why can't one use binary search to find a floor that doesn't break, then check above and see if it does?

  • @sriramkasu7511
    @sriramkasu7511 4 года назад +1

    sir where is the link for code

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated - we only maintain backtobackswe.com now.

  • @vman049
    @vman049 4 года назад +1

    I’m definitely misunderstanding the question because with one egg, couldn’t you just start at floor 0 and go up until it breaks, therefore solving this in O(totalFloors) time? What is the advantage of having more than one egg? What am I missing?

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      I dont remember this video nor the question

    • @vman049
      @vman049 4 года назад

      Anyone else have an answer?

  • @karmavadaa
    @karmavadaa 3 года назад +2

    Great explanation!!
    Egg Drops, from floor’s and not breaking its unsettling though!! Going to think of it as Coconut Drop 😐

  • @kartikaygoel3042
    @kartikaygoel3042 4 года назад +2

    If the total numbers of eggs are 1, then why are we returning total floors? It may be the case that we don't need to get to the top floor and before that we get the pivotal floor

  • @5590priyank
    @5590priyank 4 года назад +1

    Since this is a monotonic function, cannot we solve it using binary search?

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      im not sure

    • @5590priyank
      @5590priyank 4 года назад

      @@BackToBackSWE so my idea is, let's say there are 100 floor. We first check at floor 50. If egg don't break we know answer is higher floor. If egg break, answer is lower floors.
      We repeatedly do same at the middle element of the range. So in log N time, we can derive answer.

    • @5590priyank
      @5590priyank 4 года назад

      So we need ceil of LogN eggs at max.

    • @vijay6877
      @vijay6877 4 года назад

      Yes, This is the same thought going in my mind and I don't know why but no one is talking about it. Throughout the video, I'm thinking about binary search.

  • @alieltoney
    @alieltoney 5 лет назад +1

    in which order do i have to watch your dynamic programming series ?

  • @안광훈-x3p
    @안광훈-x3p 3 года назад

    Best explanation ever!

  • @kushagrasharan7896
    @kushagrasharan7896 4 года назад +2

    Hi,
    I am not able to understand how for 2 eggs and 10 floors the answer is 4.. Shouldn't it be 5?

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      im not sure - this video is very old hard to remember anything

    • @AnshumanKumar007
      @AnshumanKumar007 4 года назад

      Just input the value in the LC question to confirm your guess.

    • @kushagrasharan7896
      @kushagrasharan7896 4 года назад

      @@AnshumanKumar007 I know the answer is 4. But why it is 4?

  • @waxylayer8353
    @waxylayer8353 4 года назад +2

    I got my first job ( 18 lpa ) all coz of your videos.... Thanks a lot dude .. keep helping people ❤️

  • @danneal3735
    @danneal3735 4 года назад +1

    Thank you very much

  • @rahuldeepattri9244
    @rahuldeepattri9244 4 года назад +1

    Why drop(2, 1) when we already know the answer to that???

  • @yashshreeshinde4394
    @yashshreeshinde4394 4 года назад +1

    Your teaching are very clean and understandable ,I am glad to get a teacher like you in my journey of career.You deserve more subscribers.Good luck ,keep it up!🌈✨

  • @vedantverma5185
    @vedantverma5185 2 года назад

    Commendable explanation !

  • @notexlol3125
    @notexlol3125 4 года назад

    I have seen tons of your videos, and I never found the code in the description. Could you please tell me where is it exactly?

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated, we only maintain backtobackswe.com now.

  • @vibekdutta6539
    @vibekdutta6539 5 лет назад +5

    You are really gr8, thanks sir! I hope you do Great things in life! Respect

  • @rajatpratapsingh2744
    @rajatpratapsingh2744 2 года назад

    Hey, I cannot find the code in the description, can someone help?

    • @BackToBackSWE
      @BackToBackSWE  2 года назад +1

      Check it out on backtobackswe.com/

  • @monil1601
    @monil1601 5 лет назад +1

    What will the final recurrence look like considering m eggs and n floors ?

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      not sure, I forgot everything I said in this video.

    • @monil1601
      @monil1601 5 лет назад +1

      @@BackToBackSWE alright, I'll figure it out. Even the coin change video doesn't have the recurrence nevertheless you explained both of them very well.

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад

      @@monil1601 thx

  • @hrishikeshpanse4790
    @hrishikeshpanse4790 4 года назад +1

    code is not present :(

  • @rati396
    @rati396 5 лет назад +1

    very good and detailed explanation , thank you !

  • @adnanmasroor742
    @adnanmasroor742 3 года назад

    finally I am beginning to understand the problem!!

  • @VocalWithShubham
    @VocalWithShubham 4 года назад +1

    Hi Benyam, I just want to say that can you make a video that explains the optimal version of this algorithm with takes O(totalEggs*totalFloors) time or any lesser time because this code showing TLE in interviewbit and leetcode as they both have large input constraints. I can't able to understand their solution and also there is no video that explains that optimized solution.

    • @BackToBackSWE
      @BackToBackSWE  4 года назад +1

      I currently cannot due to time constraints Im sorry

  • @stonecoldcold2941
    @stonecoldcold2941 4 года назад +1

    Where is the code ?

    • @BackToBackSWE
      @BackToBackSWE  4 года назад

      The repository is deprecated - we only maintain backtobackswe.com now.