There are very rare people who teach geniune content on YT without any fake drama or promotion. Wish we have more people like you
@prabhatpandey16384 жыл бұрын
It is very important to understand why we are sending (f-k) in case of egg didn't break and again using a for loop where k is initiated from 1 again. the reason is we are checking for a range where we are min number of possibly attempt where egg didn't break. Let's say in simple terms there are 10 floor. Egg didn't break from 7th floor. So now only 10-7 = 3 floor needs to be checked. But to check the next 3 floor we need to use a k loop again. Here k=1 will represent 8th floor. Here k=2 will represent 9th floor. Here k=3 will represent 10th floor. So to answer the initial question , You need to check the min number of attempts in next 3 floors and that is why you are sending (f-k) and k range is (1,f-k) PS. I was not able to understand for 2 days why we are looping from K=1 again. Putting this explanation out incase someone gets stuck in the same point again.
@nileshdand24314 жыл бұрын
Bro can u explain why are we using max, i.e how are we understanding the worst the case in this
@monildand43664 жыл бұрын
can you explain use of max.
@kumarsaurabhraj69174 жыл бұрын
@@nileshdand2431 Will try to explain this, we have to find the minimum number of attempt to find the critical floor, we don't know which floor would be the most optimal floor to make the first attempt hence we are trying out all the floors through the loop, also we do not know if dropping from a certain floor will cause the egg to break or not so we are testing for both cases one in which we assume that the egg would break and in the other we assume that it won't, recursive calls with left over eggs and floors in both cases give us the number of attempts required. But since the question asks us to assume the worst case we take the possibility as a fact which requires greater number of attempts to find the critical floor. In simpler terms, suppose if we are testing for the 3rd floor then we check the number of attempts to find the critical floor for both cases if the egg would break from the 3rd floor and if the egg wont break from the 3rd floor, if it requires greater number of attempts to find the critical floor if the egg would break if dropped form the 3rd floor then we would assume that upon dropping from the 3rd floor the egg would actually break because we want the worst case here. Then we take the minimum of number of attempts required for finding the critical floor in worst case of all of the floors in our range and that is the answer. This was a little long but I hope this clears things. Thanks
@silverbullet_64 жыл бұрын
thanks bro........saved my time!
@nikhil085143 жыл бұрын
Exactly what i was looking for.. Thanks :)
@lakshaychawla782 жыл бұрын
Adi bhai, mujhe 3-4 months ho gye jb maine first time ye DP ki series start ki thi. Uske baad i went through all of different topic series you taught. Even today sometimes i revise such concepts and questions before some interview or so. Mai dil se shukriya krna chaunga for such great concept building exercises ❤️❤️ and even urge you to make such videos for other concepts as well like backtracking, greedy, graphs etc. People need you👌🏻
@vedantnaikwadi53942 ай бұрын
bro app kis company me ho abb?
@kumarsaurabhraj69174 жыл бұрын
Some hints if someone is having a hard time understanding this We are given with the number of eggs and the number of floors in the building We have to find the minimum number of attempts to find the critical floor with the given number of eggs (we can have leftover eggs) If we have only one egg then there is only strategy to keep dropping eggs starting from the bottom till we get to a floor where the egg breaks then we found the critical floor which will be the floor below it We do not have any facts on where from dropping from a particular floor wheather the egg breaks or not, for every floor the egg may or may not break We have to find the niminum number of attemps it would take to find the threshold floor in the worst case What would be best case? We select any floor and drop the egg from it and it does not break and we drop the egg from the floor above it and it does break, then our previous floor will be the critical floor. So in the best case it would take us two attempts and 1 egg to find the critical floor. Why just testing for in the middle and halving the floor is not necerrily a good solution? Becuase if you have only one egg left then you would have had to make as many attempts as there are floors to find the critical floor. What we are doing here? Our function returns the minimum number of attempts required to find the critical floor with E eggs and F floor (given in arguments), we dont what would the most optiomal floor to make the first attempt from so we are making attempt from every floor, we also dont know if by dropping from a floor wheather the egg would break or not so we test for both the cases, we recursively call the function for the left over floor and eggs, since we assume the worst possible case here and we do not know if from dropping from a floor wheather the egg will break or not, we check for which situation it would take greater number of attempts to find the critical floor and take that one. Also since we want the minimum number of attempts to find the critical floor in the worst possible case we take the minimum of the number of attempts required in the worst possible case when the first attempt is made from that fllor and return that as our answer. Under standing base cases, When there is only one egg then we would have to make as many attempts are there are floors in the worst case to find the critical floor. When there is only one floor then we would have to make only one attempt if the egg does not break then its the critical floor and if it does then ground floor is the critical floor, so the number of attempts in this case also would be as many as there are floors. When we have no eggs then its not possible to find the critical floor. Wehn there are no floors i.e. 0 floors then the group floor will be the critical floor so the answer would be equal to 0 i.e. number of floors.
@vasutiwari41873 жыл бұрын
where are some hints ??
@gamingKlips993 жыл бұрын
good
@nitinkumar59743 жыл бұрын
Good ,Well explained 👍
@siddharthsharma39143 жыл бұрын
Thanks a ton for explaining.
@RitikSingh-bt3gp3 жыл бұрын
english subtitles to the video..xd
@visase20362 жыл бұрын
For those who did not get the max and min usage here : Consider there are 10 floors in total and we got some x eggs to test . Lets say we are at 8th floor now(Problem would start from the 1st floor but consider that we are at 8th) . Here we have two options . 1. Egg breaks (we are left with x-1 eggs and 7 floors (8th floor is not the critical one so go down by 1 floor) 2. Egg does'nt break ( we are left with x eggs and 2 floors(9,10 to test) as 8th floor did not break , its waste of time to go down and check other floors as the problem states if the egg doesnt break at one floor it doesnt break on the floors below to it as well )) Now here comes the critical point to note , floors to test now are 1. 1-7 so total of 7 floors(egg broke) 2. 9-10 so total of 2 floors (egg did not break) Whom do you think will give the us the answer Max(attempts (7 floors), (2 floors))) , obviously 7 will yeild more floors to test (Keep in mind , you have to cover all the floors so go by max). So that is the reason why we use max(floorsRemainingEggBrokenCase, floorsRemainingEggunbrokenCase) And finally here comes the min part : Now we tested this by dropping the egg at 8th floor , similarly 3rd floor will yeild us an answer , similarly 5th floor will yeild a diff ans and so on ... till n floors Tats y we return the min(egg drop attempts on all the floors)!
@alexwhitewood6480 Жыл бұрын
Well explained
@pranjalck Жыл бұрын
Thanks bro it helped
@kashishkatiyar7923 Жыл бұрын
thannx bro
@manasvinsharma17402 жыл бұрын
At first, it looks like a problem which can be solved by Binary Search
@kartikwar80222 жыл бұрын
It can be solved. But he has given a solution without it. You can optimize further by using binary search
@g8dboyplays7902 жыл бұрын
You can, but that will require infinite eggs to reach the solution. There are limited no. of eggs, so we prefer DP here.
@KiyotakaAyanokoji1 Жыл бұрын
@@g8dboyplays790 floors limited hai toh infinite egg kaise lag sakte binary serch me
@KiyotakaAyanokoji1 Жыл бұрын
ha at first , it seems ki we were given the value of threshold floor. then we could apply binary serch
@AnshiPatel_official Жыл бұрын
Exactly
@0anant04 жыл бұрын
42 of 50 (84%) done! The concept is explained very nicely.
@shashishekhar17294 жыл бұрын
KAUN HAI YE LOG , KAHA SE AATE HAI YE LOG!
@aishwarya18953 жыл бұрын
Man your consistency ✌️
@starc7014 жыл бұрын
max is used since ,we have to find guaranteed moves to find the breaking floor, to find gurantee we take worst cases. Nice vdo
@lakshsadhwani8553 жыл бұрын
man you never can explain bad🙈 respect bro for the content you give us , keep growing❤️
@ytg66632 жыл бұрын
Laksh
@manishkumargupta86772 жыл бұрын
Angrez wali English nahi pel diye bhai idhar tum? Hindi me video dekh karke
@sleepypanda71722 жыл бұрын
@@manishkumargupta8677 isse zyada simple english kya ho skti hai? sahi se toh bola hai vo. Angrez wala kya hota hai. Ek seedhi si line likhi hai
@Official-tk3nc4 жыл бұрын
my 12 years old brother saw this video with me now he can solve egg drop problem conceptually:)
@TheAdityaVerma4 жыл бұрын
Haha Really dude? 😂😂 I am hope your not forcing him to watch videos to turn him into a programmer at a young age 😂😅✌️
@adarshsharmanit3564 жыл бұрын
@@TheAdityaVerma Indian Errichto Ban jaayega ,aisa banda 12 saal se hi start kar dega toh , Bhad mein jaaye JEE , Google phod dega aise hi 😂😂
@rahulagarwal80594 жыл бұрын
😂😂
@AnkitSingh-qz8ix3 жыл бұрын
chintu or wott
@kaal_bhairav_243 жыл бұрын
bhai wolf gupta se door rakhio apne chote bhai ko
@anshulgoel1940 Жыл бұрын
Some people call this as front partitioning and not MCM and I was always confused whats the damn difference. This video made it super clear. Just a small variant of the same thing.
@chhaviagarwal75143 жыл бұрын
Loved your way of teaching..Can you please upload videos for remaining topics like kadane's algo and Longest Increasing Subsequence🙏🙏
@bharatnihar2 жыл бұрын
Bhai maja aagaya explaination dekh k.Baith gya dimag m Best tutorial for this question on KZbin.
@nitianthrive6099 Жыл бұрын
Dil se hats off for your explanation 🫡🫡
@gaunikasrivastava78512 жыл бұрын
This problem is tougher than scramble string problem 😅😅
@MakeuPerfect2 жыл бұрын
Because of Max
@rishabhgaurav4 жыл бұрын
And Can you Please List Down the question at least of the topics which you couldn't upload. Like In the first video you mentioned... Fibonacci(7 questions) LIS(10 questions) Kadane's (6 questions) DP on grid(14) others(3) So that I can complete these topics as well. PS: You have a very good and curated playlist.
@TheAdityaVerma4 жыл бұрын
Do not have a list right now Sorry 😕, But will try to upload them as well.
@sauravdas75914 жыл бұрын
leetcode.com/discuss/general-discussion/458695/dynamic-programming-patterns> try this, as it contains a no of separate patterns dp
@0anant04 жыл бұрын
@@sauravdas7591 Highly underrated comment. Should be pinned on the first or last video of this DP series.
@sachinsharma9053 жыл бұрын
@@sauravdas7591 Thanks man.
@ahishnar15683 жыл бұрын
@@sauravdas7591 Thanks man
@CricketGalaxy07-18 Жыл бұрын
me ye ek problem sikhane aaya tha or puri MCM pertan sikh li thanks sir 🤩🙌🙌
@lj27384 жыл бұрын
bhai may month aa gaya hain ,waiting for new series..& thanks :)
@bhargabnath57813 жыл бұрын
bhaiya, I'm sure that you you must be unwell atleast a little bit, I hear your voice and feel like this. How can I show you my respect for you? Thank you so so much bhaiya, like every videos, this too is simply lit. Kudos to your dedication, bhaiya!!! :) :) :)
@ahishnar15683 жыл бұрын
If someone is not able to understand the problem itself then read below explanation. Here in this problem we have to find the minimum attempts required to find the threshold floor in worst case. For finding this on every step of recursion we have to find one floor or such a floor from which if we drop an egg then we would be required a minimum attempts overall to find threshold floor overall. And if we follow this concept which I just explained on every recursion step till vase case get hit then with magic of recursion we will automatically get most optimized approach in worst case. e.g. Let's say we have 5 floors as 5 4 3 2 1 Then in for loop we have to check one floor or such a floor from which if we drop an egg then we overall we would get minimum attempts. So in for loop first we will check for 5 then check for 4 then for 3, 2, 1 and at then end as we required minimum number of attempts so in for loop after finding for was floor that is after assuming each floor as the first floor to drop from, we will take or we will pick that floor from which if we drop an egg then we required minimum attempts. And so in for loop we use min function. Now the second thing is after dropping an egg 2 things can happen, either egg will break or not break. If egg breaks then we will go down to check and if egg does not break then we will go up to check. Now as we need minimum attempts in worst case, concentrate here I am saying in worst case we required minimum attempts and so as we are checking for worst case then egg breaking can be the worst case or egg not breaking can be the worst case. But we do not know which is the worst case and so we are cheking for both the cases. And so we have to take or use max function here so that we can catch the worst case. And that is why while calling egg break and not break recursion calls which are below the current floor and above the current floor respectively we have to use max function. So in short on every step of recursion out of all the floors we have to find one floor or such a floor from which if we drop an egg then we would required minimum attempts. I hope this helps :)
@AnushkaRai-mr8hh5 ай бұрын
Yess! Finally I got it! Thanks!
@yashmittal90404 жыл бұрын
had to watch this video like to 4 to 5 times to properly understand what is the meaning of worstcase but finally understood
@chavanitinsaichowdary80882 жыл бұрын
Can u explain
@himanshusoni15122 жыл бұрын
For 100% certainty, always consider the combination of your BEST and others' WORST Case.
@ShreyaSingh-vr9qi4 жыл бұрын
Nice explaination !! I was confused a lot about why to choose worst case but now its cleared. Thanks for explaining.
@TheAdityaVerma4 жыл бұрын
I am glad it helped you. Share where ever you can it would help me :P
@aparnatiwari6442Ай бұрын
Thanks for the amazing explanation
@kumarsaurabhraj25384 жыл бұрын
I think there should be another base case, when e == 0 then return INT_MIN or -1 since its not possible to find the number of attempts to find the critical floor if we have no eggs so we would want such cases to be eliminated in out max() comparison.
@prakhargupta57203 жыл бұрын
for those who didn't understand why we use MAX :- assume that for 1 to f floor we put k somewhere in between of 1 and f and we find the answer then it would be the best case. But here we have to check each floor because we have to find the last floor where egg didnt break , not the floor where egg breaks. Hope u undrstand.
@harshdeepsingh67683 жыл бұрын
Bro I am struggling to understand this, can you please explain it with an example... like what would have happened if we took min instead of max there.
@OmkarGhanekar2 жыл бұрын
@@harshdeepsingh6768 That is because we don't know if, after choosing to have an attempt from floor k, our egg will break or not and subsequently we dont know which path we will have to take. So we account for whichever path takes us more attempts and then declare that if we choose to drop from k then we will DEFINITELY be able to solve it in 1 + max(recursive calls) attempts. so we calculate this collection of "can definitely solve it in N drops" for all Ks and then pick a K where this value is smallest
@pavankumar-cy6mg3 жыл бұрын
.It is not ruled out that the first-floor windows break eggs, nor is it ruled out that the 36th-floor do not cause an egg to break.
@iamnoob75932 ай бұрын
Thanks very good explanation
@prakhartiwari81534 жыл бұрын
bro eagerly waiting for other patterns like Fibonacci series etc,,,,, :(
@codebot10273 жыл бұрын
Thank You Soo Much Aditya, You Explained It Very Well...
@gauravdixit22884 жыл бұрын
@Adi bhai can u please tell the time complexity of recursive version and also please discuss the n^logn approach
@saurabhthakur2718 Жыл бұрын
very simple explanation, thank you !
@harshchiki77964 ай бұрын
you built the building some many times - it felt like a civil engineering problem than the computer science problem some times.
@alexamish20204 жыл бұрын
I have a major doubt, We are calling solve(e, f). Doesnt it matter, what length of last K we have already checked ? Why the answer always depends on the number of floors and not the floor number. Please clear.
@akhilmanoj55124 жыл бұрын
When the egg breaks from the k-th floor, we consider a subproblem with the height of the building as k. Similarly, when it doesn't break from the k-th floor, you can consider another subproblem with the ground being at the k-th floor level. Due to this fact, the floor number doesn't play a role in the solution.
@RanjeetSingh-st2vu4 жыл бұрын
Sir in this problem why we can't use binary search?
@ritishdhiman264 жыл бұрын
best lectures on dp , thanks :)
@shakshigupta1336 Жыл бұрын
Why can't we use binary search for e-1 eggs (halfing the floors each time) and then use the last egg one by one for remaining floors?
@badabeta697311 ай бұрын
I have the same doubt can anyone explain
@167shivamrai23 жыл бұрын
@aditiya verma Really appreciate your efforts , that helps all of us. I think govt. should give job to teachers like him who are devoted and dedicated to their work . The govt should pay them salary double which are getting in MNCs , to teach the youth . This man skills and presentation work is so good , then those of NPTEL lecture teachers which are being arranged by govt for youth programming education. Man like him want to teach and understand the importance of basics taught to young programmers , but can't balance all time to do so because of their job roles. I wholeheartedly wish teachers like him should given importance by govt. as they are nourishing the youth with great programming skills . I don't have free time to write such a long comment, but this man deserves appreciations from all of us. If you like this, pls share this on linked in . With mentioning name of teachers like him who should be given vote of appreciations.
@amanchauhan74513 жыл бұрын
Do this Problem is practically possible? How we can determine that the minimum no of Steps for finding Threshold floor for Floors =100 and Eggs = 2 is 14 ???
@AryanGairola-th3qc3 ай бұрын
go to 50th floor drop it if it breaks strat from 1 because now you rae left with 1 only if it doesnot break from 50 th than go to 75 and repeat the process but as you said it breaks you will ned 15 steps first to got to 50 and then 1 byb one till 14
@csinfoplus37888 ай бұрын
Great explanation ...
@siddharthkeshri56493 жыл бұрын
I think a best approach of this problem can come from binary search it's just a hunch not checked till now
@Bdixit3 жыл бұрын
I was also thinking somewhat this in my mind.
@siddharthkeshri56493 жыл бұрын
@@Bdixit yes Bro a approch exists of Binary search and its the best one 😅
@oqant04243 жыл бұрын
though took some time to understand .....but the explanation was awesome!
@dinakarmaurya80003 жыл бұрын
Is it possible to try using binary search technique? Try to fall from middle?
@abhishekbajaj1094 жыл бұрын
If you have a doubt that why we are taking max then let me explain you the question is using you to find minimum no of attempts to find the threshold in worst case. Focus on the word Worst case if we take min there we would not get the answer for the worst case for eg take 2 eggs and 2 floors 1) 1+max(sol(0,0),sol(1,1)) from this you can tell if egg breaks in first floor then its not the worst case here the worst case is 2nd floor so we go to second floor to test it so from there you will see why we used max and later to find min attempts we use min . i hope this helps.
@maximus64483 жыл бұрын
N^ 2 solution : def superEggDrop(self, egg: int, floor: int) -> int: dp = [[0]*(egg+1) for i in range(floor+1)] for i in range(1 , floor+1): for j in range(1 , egg + 1): # two case arises starting from ground floor # when we are moving from bottom to top either # egg breaks or not if egg breaks we decrease egg count # else not and 1 is increasing the number of attempt after # every floor when egg breaks. # dp[i-1][j-1] when egg breaks # dp[i-1][j] when egg does not break. dp[i][j] = 1 + dp[i-1][j] + dp[i-1][j-1] if dp[i][j] >= floor: return i
@mickyman7533 жыл бұрын
the critical floor can be any floor and it is not any specific floor, worst case main kisi bhi random floor se start krne pr kitne minimum attempt lgenge , aise sab starts se no. of attempts ka minimum nikalna hai
@ankoor4 жыл бұрын
Python: Recursive def Solve(eggs, floors): if floors == 0 or floors == 1: return floors if eggs == 1: return floors count = float('inf') for i in range(1, floors+1): temp = 1 + max(Solve(eggs, floors-i), Solve(eggs-1, i-1)) count = min(count, temp) return count eggs = 3 floors = 5 attempts = Solve(eggs, floors) print('# of attempts: ', attempts)
@roliagrawal31243 жыл бұрын
@Aditya Verma I am not getting why we are taking worst case?
@navjyotbhele83073 жыл бұрын
because in best case we only need 2 attempts. That is we choose a random floor luckily and the egg is not broken from that floor(1st attempt) and from the floor on top of it, egg breaks(2nd attempt) that is the curr floor is critical floor. Hence we require 2 attempts only. hence we are asked to to take worst case
@MrRavi20khatri3 жыл бұрын
Wise way to use egg is to make omlet...
@deepankaradhikari54054 жыл бұрын
In mid of this video, I realize ki abb pen ghumana aa gya
@kitkat58422 күн бұрын
I almost solved it. It fits with Binary Search + Recursion (for considering the two possibilities)
@Shobhitgupta0110 ай бұрын
I Still have problem understanding why we are using MCM technique here. MCM us generally used when we need to create subgroups in an array/string and calculate something. wg A1A2A3 => (A1)(A2A3), or T&F|T => (T&(F|T)). K is meant to create a partition and we recursively find partitions on existing ones. Can't visualize here why we need to do this and why cant we use binary search. Please help
@mathematicsquestions2 жыл бұрын
It seems recursion rather than dynamic programming. Which part of it defines dynamic programming used? Please explain.
@kalyanking10803 жыл бұрын
after seeing this problem my reaction 26:50
@__RohitDevar3 жыл бұрын
😄😄😄
@arjunkhanna18032 жыл бұрын
Can we use binary search on answer?
@avmovies79303 ай бұрын
Please complete full DP series
@manojnavinjamuri5867 Жыл бұрын
thank you soo muchhh
@mahipalsingh-yo4jt4 жыл бұрын
great explanation sir ........
@prayagpatel91362 жыл бұрын
worst case basically implies "guarantee of k we have found" right?
@David-mk8kh Жыл бұрын
I understood all the problems before with a great ease, but this problem is a bit different and confusing then all the previous problmes😵💫😵💫🥴😢😬
@girikgarg82 жыл бұрын
I had a doubt here.... in MCM pattern we usually consider invalid input... so here why did we consider smallest valid input?
@motivational_dosee2 жыл бұрын
This problem seems very simple but logic is too deep and confusing 💀
@anantjain12633 жыл бұрын
Why we are adding 1 + in max I didn't understand the answer , please help
@amanburman91143 жыл бұрын
At that iteration, you are dropping an egg to check whether it will break or not. The question asks minimum no. of "attempts", so when you drop an egg, you increase your "count of attempts" by 1. Meaning you "attempted" to check whether egg will break or not. Hope you understand.
@vaibhavjadhav89874 жыл бұрын
great video bro... really helpful....but 50th floor se egg kon drop karta hai yaar(just for fun)
@TheAdityaVerma4 жыл бұрын
Thanks !! Placement k liye sb krna pdhta h bhai 😂😂
@chiragkushwaha5464 жыл бұрын
@@TheAdityaVerma 🤣🤣🤣
@tanmay64412 жыл бұрын
bhaiya ham middle se kyun nhi faik sakte? usme bina mcm ke hojayega binary search jese kuch
@pavankumar-cy6mg3 жыл бұрын
what do you mean by break at any floor in coding
@shiwamjaiswal96534 жыл бұрын
What I have understood from the "worst case" is if the no of attempts are maximum by breaking the eggs to find the threshold floor (i.e. by going down) then we keep breaking till we have one egg remaining. Else we don't break any eggs and go to the top most floor and count the number of attempts to reach there. And in the final answer we take maximum of both the answers. That means we never stop in between the floors. This is the reason why we take Base Conditions : if(e==1) return f; // if we have one egg left we simply return the number of floors given considering that in worst case we don't break any egg and reach to the given number of floor. if(f==0||f==1) return f; // if we have only one floor/No floor then that is the worst case regardless of the number of eggs we have. Can anyone validate my thought process?
@ekanshsharma42934 жыл бұрын
Yes it's completely correct
@devendrasingh47764 жыл бұрын
We are stopping at every floor because for each floor we again have to think for two case s
@bhavneetsingh20004 жыл бұрын
I still didn't get why we maximized for worst case?
@kartiksaini56192 жыл бұрын
i think this can be solved using binary search as well ,kindly correct me if i'm wrong ,cuz i haven't tried solving it using bsearch but while going through i got an idea
@pranjal-barnwal2 жыл бұрын
Binary Search will pass only for few testcases where eggs are sufficient (i.e. number of eggs >= log(number of floors) ). Like if eggs = 2 & floors =100, you can solve this with binary search as you would need in worst case 7 eggs
@madhurbhargava4 жыл бұрын
Bro, you need to use binary search in place of your for loop, otherwise this will give TLE despite memoization on LC.
@mainaksanyal95154 жыл бұрын
Even I find it similar to binary search problem. We can split it in two halfs always to check if the egg breaks or not. And lets suppose we are at mth position in doing so and have only 1 more egg left. Then worst case can be (n-1)+(m-1) cases. And if f is smaller that 2^n then it is more easy to find. I don't get why we have to make this ques analogous to MCM!?
@madhurbhargava4 жыл бұрын
@@mainaksanyal9515 That is actually a better/more efficient way of doing this. Although for small inputs, bhai ne bahut accha samjhaya hai.
@srini94 жыл бұрын
बहुत बदिया भाई
@manthoshn43864 жыл бұрын
binary search will work when you have unlimited no of eggs for trials,,, here we have limited eggs
@madhurbhargava4 жыл бұрын
@@manthoshn4386 do enlighten me why the binary search should not work on limited I/p. Also, do show me a piece of code which passes on lc without a d&c algo for this problem.
@dhruvbhanderi34073 жыл бұрын
can't we apply binary search?
@melbinthomas21994 жыл бұрын
Awesome explanation
@akhiranandanpallepogu7337 Жыл бұрын
Bro casually dropped f bomb at 26:48 😂
@learntogrow61322 жыл бұрын
this ques would be much practical if thereshold was given and we need to calculate the ways
@keshavraghav38962 жыл бұрын
Can we do this problem using binary search.?
@tanujaSangwan2 ай бұрын
All these questions are literally so tough. scrambled eggs, egg dropping, expression to True/False. Do people actually solve it in the first go? Or I am just dumb.
@sujayshanbhag2055 Жыл бұрын
why find out minimum of worst cases though? it is easy to understand looking at the code, that it is taking minimum of worst cases. But why tho? I understand that to be sure we might need to calculate max of both recursion calls, but why take minimum of all such cases. shouldnt we also take worst case here to be sure that a solution can be reached in the given number of drops, any way we try to start to drop.
@cripz42034 жыл бұрын
Can we get more optimised answer if we iterate k just like we do for binary search rather than linear.
@0anant04 жыл бұрын
Yes, since the floors are already a 'sorted array'. If broken >= unbroken, hi = mid, else lo = mid+1
@aishuo073 жыл бұрын
nope
@Kuriocity3 жыл бұрын
For Binary Search, we ll require log n eggs but here we have limited
@satwikjain6177 Жыл бұрын
if you understand the problem statement clearly you can start from here 11:40
@nitinchandel81033 жыл бұрын
can some body tell me what is the role of no. of egg here , even if we drop a single egg it is considered as an attempt
@kapil63923 жыл бұрын
why can't we use simple binary search till no: of eggs left is 1 and then for the last egg we can use simple loop within the range.
@rkalpeshk3 жыл бұрын
JAVA CODE : static int fun(int egg, int floor) { if (floor == 0 || floor == 1) return floor; if (egg == 1) return floor; int min = Integer.MAX_VALUE; for (int k = 1; k temp) min = temp; } return min; }
@dhirisalasaisankar4338 Жыл бұрын
Why recursive calls are under for loop
@gouravchalotravlog2 жыл бұрын
Ya kush binary search jasa question lag raha ha kya is ma BS lag sakti ha ? bhiya ji
@SwikarP2 жыл бұрын
great video
@SurjitSingh14-c6i3 жыл бұрын
Can't it be solved by binary search
@aanchalsingh57823 жыл бұрын
Why can't we apply binary search in this ??
@ARYAN_BAJPAI_IIT_BHU5 ай бұрын
can we use binary search
@abhisheksuryavanshi96754 жыл бұрын
Please upload new videos..May is about to get over
@anjalichoudhary54674 жыл бұрын
Thank you :)
@TheAdityaVerma4 жыл бұрын
You're welcome!
@bharataaryavrat40673 жыл бұрын
can you see my mistake ,i am geeting wrong answer #include using namespace std; #define ll long long // string dp[4001][4001]; vectordp(4001,vector(4001,"")); int main() { string s1,s2; cin>>s1>>s2; ll n=s1.length(); ll m=s2.length(); for(ll i=0;i
@pqazx14 жыл бұрын
how to print the ans for each floor??
@shivangishukla26294 жыл бұрын
amazing explanation!
@shubhamchaudhary86884 жыл бұрын
Worst case kind of means jb bhi ham jo choose kare uske opposite mein answer/crticial point hai isliye ham hamesha max lenge!
@Finimals2 жыл бұрын
Why cant we do it from Binary search eg 14 floors, worst case is 14th floor, so first solve at 7 and it will break , then solve 11 , then 13 and then 14 ans 4 attempts
@kartikwar80222 жыл бұрын
binary search to use hua hi ni isme. I think binary search se aur optimise ho sakta hai