No it won't work, Question has the below statement as well. Hence how will you handle this? "If the pile has less than k bananas, she eats all of them instead and will not eat any more bananas during this hour."
If we keep start as 0 then there may be some test case where my mid will become 0.[ this is because mid can be any value in between start and end]. Now if mid becomes 0, we will get Divide by zero error.
Yeh question ek pattern pr based hai, binary Search on answer concept. Lecture 23, 24, 25, 26. Yeh 4 videos dekh lo. Sare concepts smjh aa jaenge. Phir iss pattern ke sare questions solve ho jaenge
Watch at 1.25x for better experience
Thanku sir, this is best explanation of the solution. and the best part is you do live coding , instead of explaining a code snippet.
Very nice explanation
Nice explanation
day 7 done #junecodechallengewithshashwat
why don't we take the total sum and then check if answer = (total /mid )+ total % mid
No it won't work, Question has the below statement as well. Hence how will you handle this?
"If the pile has less than k bananas, she eats all of them instead and will not eat any more bananas during this hour."
Day 7 challenge completed #junecodechallengewithshashwat
Can you tell me where i could be missing out!
Day - 7 completed #junecodechallengewithshashwat
Great
Day 7 completed
#junecodechallengewithshashwat
Same ques get stucked for test case -108
TLE
Okay, I will check it.
bhaiya nice explanation but why start is 1 and not 0 ?
If we keep start as 0 then there may be some test case where my mid will become 0.[ this is because mid can be any value in between start and end].
Now if mid becomes 0, we will get Divide by zero error.
jai ho placement baba ki...
🙏🙌🙌
Sir mene questions toh kiye hai dsa ke basics ke but me iss tarah ke questions me fas saa jaata hu ese me mujhe kya karna chaiye sir pls guide me
Yeh question ek pattern pr based hai, binary Search on answer concept. Lecture 23, 24, 25, 26. Yeh 4 videos dekh lo. Sare concepts smjh aa jaenge. Phir iss pattern ke sare questions solve ho jaenge
Sir -> ( piles =
[805306368,805306368,805306368]
h =
1000000000
Use Testcase
Output
1
Expected)
3 one test case is failed;
Kuch galat kr rhe Hoge. Mera work kr rha hai same code pr. Ans is 3.
Bro I need ur help can I get ur mail id
shashwattiwari8 gmail