Minimized Maximum of Products Distributed to Any Store - Leetcode 2064 - Python

  Рет қаралды 8,225

NeetCodeIO

NeetCodeIO

Күн бұрын

Пікірлер: 41
@NeetCodeIO
@NeetCodeIO 17 күн бұрын
Maybe i should change my shirt color based on the difficulty of the problem. Thoughts?
@bzrkr444
@bzrkr444 17 күн бұрын
Start wearing different coloured flannels like Anthony Fantano
@Tejesh-t1t
@Tejesh-t1t 17 күн бұрын
genuis
@adityamanitripathi478
@adityamanitripathi478 17 күн бұрын
So cool
@yassinmohamed7240
@yassinmohamed7240 17 күн бұрын
Cool
@leeroymlg4692
@leeroymlg4692 17 күн бұрын
hard problems = shirtless
@ankitpratap2496
@ankitpratap2496 17 күн бұрын
For C++, you need to ensure floating point division: double real = static_cast(quantities[i]) / a; int val = std::ceil(real); stores += val;
@finemechanic
@finemechanic 16 күн бұрын
Or you can avoid floating point arithmetic altogether. stores += quantities[i] / a + (quantities[i] % a ? 1 : 0); You may google for even more sophisticated, but less explicit solutions.
@RakimMiddya
@RakimMiddya 16 күн бұрын
you can just stores += (quantities[i]+a-1)/a; learnt it from larry's vid
@Farkhod-i7n
@Farkhod-i7n 17 күн бұрын
bro be scheming up in O(1) in that thumbnail
@unlucky-777
@unlucky-777 17 күн бұрын
9:52 I think our left can be = ceil(sum(quentities)/n) because we know that we must to deliver item to every store and instead of starting 1 (may or may not deliver the items) we can start at the lowest possible left that we know we will deliver items to each store but we don't know if it is the optimal one
@jody4210
@jody4210 17 күн бұрын
I didnt major in CS so I only took some introduction courses on programming and wasn't familiar with algorithms. But learning how to do leetcode with your videos have been so helpful. Like you suggested I went to watch the koko video you made and managed to solve this problem without having to get into the coding explanation part! I can't really say I solved it all on my own bc the koko video helped a lot due to how similar these two problems are, but I really feel that I am learning and improving. Thank you so much
@anonanon6596
@anonanon6596 17 күн бұрын
You could stop at five or six stores or, just one.
@satyajit_2003
@satyajit_2003 16 күн бұрын
@NeetCodeIO, I think instead of initializing another variable 'res' we can return r+1, I tried and it works
@greedyfishbones
@greedyfishbones 17 күн бұрын
u look so happy!! its so cute
@IK-xk7ex
@IK-xk7ex 17 күн бұрын
I solved it because yesterday's problem was binary search :)
@MP-ny3ep
@MP-ny3ep 17 күн бұрын
Beautifully explained. Thank you
@chetanshrivastava3762
@chetanshrivastava3762 17 күн бұрын
God bless you brother.Nice explanation.
@nicolasrodriguez623
@nicolasrodriguez623 16 күн бұрын
Did well on my Google interview but didn’t pass. Back to the grind I guess.
@pastori2672
@pastori2672 16 күн бұрын
bro actually did it again 😂
@programming_with_shashank
@programming_with_shashank 17 күн бұрын
Hey, in the helper function why not just divide the n value by the summation of the quantities array? Why do we have to go one by one for each quantity?
@Reck1025
@Reck1025 17 күн бұрын
Each store can only receive one type of product. You might get false positives if you just sum up the quantities
@programming_with_shashank
@programming_with_shashank 17 күн бұрын
@@Reck1025 Tried and testing for myself, makes sense now 🥲
@mohamedsayed8697
@mohamedsayed8697 17 күн бұрын
I do not mean anything about you, but I am starting to miss the old thumbnail, it was like a NeetCode trademark kind of thing, at least for me. It nice seeing you on these thumbnails tho.
@JamesBond-mq7pd
@JamesBond-mq7pd 17 күн бұрын
can someone explain why whenever we find a valid x, it’s smaller than any previously found x???
@JamesBond-mq7pd
@JamesBond-mq7pd 17 күн бұрын
i think i got it. In binary search, we always move towards a certain point, and when we set left = mid + 1, it will never be equal to or greater than the previous right = mid - 1.
@dekumidoriya-qi2is
@dekumidoriya-qi2is 16 күн бұрын
@@JamesBond-mq7pd yeah that's pretty much the reason :)
@web-unlocked
@web-unlocked 17 күн бұрын
I had no clue how to solve this problem😇 then I watch 30 seconds of the video and re did koko eating bananas 🥵then I was able to solve this problem in under 5 min🤣
@LNGAMING135
@LNGAMING135 17 күн бұрын
C++😢
@kanhaiwadekar6615
@kanhaiwadekar6615 17 күн бұрын
tf unc in the thumbnail for ☠
@whiteasian2777
@whiteasian2777 16 күн бұрын
bro thinks he is an indian dsa teacher in the thbumnail
@jalalhamzah4938
@jalalhamzah4938 17 күн бұрын
First😅
@deathxunnat4693
@deathxunnat4693 17 күн бұрын
first
@xiaoshen194
@xiaoshen194 17 күн бұрын
Bro u solved the ques and made a video and uploaded it within 25 min of the daily ques!! 🫡
Microservices Gone Wrong at DoorDash
17:22
NeetCodeIO
Рет қаралды 162 М.
Thank you Santa
00:13
Nadir Show
Рет қаралды 49 МЛН
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 331 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 700 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 743 М.
This Algorithm is 1,606,240% FASTER
13:31
ThePrimeagen
Рет қаралды 853 М.
Maximum Matrix Sum - Leetcode 1975 - Python
16:07
NeetCodeIO
Рет қаралды 7 М.
Sqlite Is Getting So Good
28:52
ThePrimeTime
Рет қаралды 209 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 120 М.
What Makes A Great Developer
27:12
ThePrimeTime
Рет қаралды 215 М.
5 Patterns to Master 80% of Leetcode Problems
15:37
Rahul Pandey
Рет қаралды 14 М.
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 200 М.