Minimum Limit of Balls in a Bag | Leetcode 1760

  Рет қаралды 4,917

Techdose

Techdose

Күн бұрын

Пікірлер: 38
@manishbolbanda4614
@manishbolbanda4614 8 күн бұрын
Techdose is my goto channel for any DSA Problem. the way you explain the approach is super good. i was part of Techdose batch in Oct-2022 and its worth the money - it really helped me crack Morgan's interview like a cup cake. Thank you Surya for your contribution.
@dieformusic1705
@dieformusic1705 8 күн бұрын
are u working in morgan's now?
@VISHALMISHRA-ff2ih
@VISHALMISHRA-ff2ih 8 күн бұрын
to be honest first I thought this is a Priority queue Problem. Hats off to your explanation.
@techdose4u
@techdose4u 8 күн бұрын
Welcome :)
@iffyaiyan8942
@iffyaiyan8942 7 күн бұрын
hey thanks for the explanation, there is some fix in the Python code, as some test cases failed class Solution: def canAssign(self, nums, max_val, operations): count = 0 for ele in nums: if ele > max_val: # Calculate the number of operations needed to split the bag count += (ele - 1) // max_val # Equivalent to ceil(ele / max_val) - 1 return count
@techdose4u
@techdose4u 7 күн бұрын
python too! there was some bug in java :o thanks
@dhruthiaddagatla2959
@dhruthiaddagatla2959 8 күн бұрын
Well explained ! But definitely, from our side we need to have the will and patience to learn and understand!
@techdose4u
@techdose4u 8 күн бұрын
yepp :)
@JuicyM0N
@JuicyM0N 8 күн бұрын
Great explanation !! Thanks
@techdose4u
@techdose4u 8 күн бұрын
You’re welcome!
@vinodpaluvuri54
@vinodpaluvuri54 8 күн бұрын
Nice explanation
@techdose4u
@techdose4u 8 күн бұрын
Thanks! :)
@SumanDas-fx5vu
@SumanDas-fx5vu 8 күн бұрын
God level explanation 🙏🙏🙏
@techdose4u
@techdose4u 8 күн бұрын
Appreciate the love! 🙏
@srikantkumar9860
@srikantkumar9860 8 күн бұрын
great explaination thank u
@techdose4u
@techdose4u 8 күн бұрын
Welcome :)
@Bruce_Wayne1720
@Bruce_Wayne1720 8 күн бұрын
you are the greatest
@techdose4u
@techdose4u 8 күн бұрын
Thanks for your appreciation:)
@sailendrachettri8521
@sailendrachettri8521 8 күн бұрын
Thank you sir :)
@techdose4u
@techdose4u 8 күн бұрын
Welcome! :)
@lohithaadapala6989
@lohithaadapala6989 8 күн бұрын
Thankyou :)
@techdose4u
@techdose4u 8 күн бұрын
You're welcome 😊
@IT__RAJVEERSINGH
@IT__RAJVEERSINGH 8 күн бұрын
Thank you
@techdose4u
@techdose4u 8 күн бұрын
You're welcome!
@vooratharunkumar4704
@vooratharunkumar4704 8 күн бұрын
why can't search space can be start=minimum_number in array and end=maximum_number in array?
@lohithaadapala6989
@lohithaadapala6989 8 күн бұрын
Take [2,3] and maxOperations = 5 and trace out. The answer is 1 but if you take the range as min then the answer would be 2 but the actual answer would be 1.
@vibhoragarwal2935
@vibhoragarwal2935 8 күн бұрын
what was your intuition for binary search? couldn't think of it
@techdose4u
@techdose4u 8 күн бұрын
It is a standard binary search assignment/asnwer range search problem. No intuition required. Practice problems: Aggressive cow, Painters partition problem, book allocation problem, Capacity To Ship Packages Within D Days :)
@rechinraj111
@rechinraj111 8 күн бұрын
Simple hai : jahan bhi MAX of MIN ya phir MIN of MAX dekho. Think of binary search.
@dhruthiaddagatla2959
@dhruthiaddagatla2959 8 күн бұрын
But my doubt is while solving this qsn for the first, how do we come to this solution !
@techdose4u
@techdose4u 8 күн бұрын
You should have solved similar questions or else this will add to your learning :)
@top10z38
@top10z38 8 күн бұрын
operations += (num - 1) // penalty i still dont get it . consider num = 8 , penalty = 4 we are checking = (8-1) // 4 = 1 -> this gives value as 1 but we can also divide 8 as 5,3 - 6,2 - 7,1 right . why are we only consider less than value
@techdose4u
@techdose4u 8 күн бұрын
yes because 1 operation is required to make 2 bags each of 4 size :)
@top10z38
@top10z38 8 күн бұрын
@@techdose4u so its like no matter the operations should be overflow the give size right ?
@techdose4u
@techdose4u 8 күн бұрын
@top10z38 Thats why we are checking if total operations are > max operations :)
@YouCodeRK
@YouCodeRK 7 күн бұрын
How I can think like this for a tricky problem like this. I know Your answer may be 'Practice'. But it does not always work.
@techdose4u
@techdose4u 7 күн бұрын
It will always work provided enough problems experience. I wouldnt suggest to worry so much if you are preparing for interviews though :)
Maximum Average Pass Ratio | Leetcode 1792
18:37
Techdose
Рет қаралды 3,2 М.
Minimum Limit of Balls in a Bag - Leetcode 1760 - Python
16:25
NeetCodeIO
Рет қаралды 14 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 10 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 153 МЛН
My Calendar II | Leetcode 731
28:06
Techdose
Рет қаралды 1,3 М.
Two Best Non Overlapping Events | Leetcode 2054
22:27
Techdose
Рет қаралды 7 М.
INTRODUCTION OF ARITHMETIC PROGRESSION EX- 5.3 Part-1 With Kedar Sir
20:02
Gati-Prada [One Who Gives The Goal Of Life]
Рет қаралды 4
I'm 24. If you're 14-23 please watch this...
6:37
Tharun Speaks
Рет қаралды 619 М.
Government Internships THAT PAY 20,000+ Stipend!
8:53
Ishaan Arora
Рет қаралды 86 М.
Sudden assault near Kursk / Putin's statement
13:04
NEXTA Live
Рет қаралды 1,1 МЛН