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.
@dieformusic17058 күн бұрын
are u working in morgan's now?
@VISHALMISHRA-ff2ih8 күн бұрын
to be honest first I thought this is a Priority queue Problem. Hats off to your explanation.
@techdose4u8 күн бұрын
Welcome :)
@iffyaiyan89427 күн бұрын
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
@techdose4u7 күн бұрын
python too! there was some bug in java :o thanks
@dhruthiaddagatla29598 күн бұрын
Well explained ! But definitely, from our side we need to have the will and patience to learn and understand!
@techdose4u8 күн бұрын
yepp :)
@JuicyM0N8 күн бұрын
Great explanation !! Thanks
@techdose4u8 күн бұрын
You’re welcome!
@vinodpaluvuri548 күн бұрын
Nice explanation
@techdose4u8 күн бұрын
Thanks! :)
@SumanDas-fx5vu8 күн бұрын
God level explanation 🙏🙏🙏
@techdose4u8 күн бұрын
Appreciate the love! 🙏
@srikantkumar98608 күн бұрын
great explaination thank u
@techdose4u8 күн бұрын
Welcome :)
@Bruce_Wayne17208 күн бұрын
you are the greatest
@techdose4u8 күн бұрын
Thanks for your appreciation:)
@sailendrachettri85218 күн бұрын
Thank you sir :)
@techdose4u8 күн бұрын
Welcome! :)
@lohithaadapala69898 күн бұрын
Thankyou :)
@techdose4u8 күн бұрын
You're welcome 😊
@IT__RAJVEERSINGH8 күн бұрын
Thank you
@techdose4u8 күн бұрын
You're welcome!
@vooratharunkumar47048 күн бұрын
why can't search space can be start=minimum_number in array and end=maximum_number in array?
@lohithaadapala69898 күн бұрын
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.
@vibhoragarwal29358 күн бұрын
what was your intuition for binary search? couldn't think of it
@techdose4u8 күн бұрын
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 :)
@rechinraj1118 күн бұрын
Simple hai : jahan bhi MAX of MIN ya phir MIN of MAX dekho. Think of binary search.
@dhruthiaddagatla29598 күн бұрын
But my doubt is while solving this qsn for the first, how do we come to this solution !
@techdose4u8 күн бұрын
You should have solved similar questions or else this will add to your learning :)
@top10z388 күн бұрын
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
@techdose4u8 күн бұрын
yes because 1 operation is required to make 2 bags each of 4 size :)
@top10z388 күн бұрын
@@techdose4u so its like no matter the operations should be overflow the give size right ?
@techdose4u8 күн бұрын
@top10z38 Thats why we are checking if total operations are > max operations :)
@YouCodeRK7 күн бұрын
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.
@techdose4u7 күн бұрын
It will always work provided enough problems experience. I wouldnt suggest to worry so much if you are preparing for interviews though :)