8:00 I have done 210 leetcode and cant miss one of your vids. You just make the problem enjoyable
@aanishas1925Ай бұрын
so true!
@yang5843Ай бұрын
I overcomplicated this problem, I thought this was going to be a harder version of coin change
@abhayrajsingh4707Ай бұрын
Me too😓
@deepakjain4481Ай бұрын
It was mentioned a easy question
@DNKFАй бұрын
LC made my day finally!
@aanishas1925Ай бұрын
4:31 well, you read my mind
@rahulsbhattАй бұрын
Thanks I didn't thought of them as bills and just calculated based on balance, I have to read the questions carefully.
@Abdul_Rahman03Ай бұрын
I had misinterpreted the problem as well, then thought about dp while reading the problem, had to see the editorial turns out way more simple than I thought.
@Munchen888Ай бұрын
It’s convenient to have a hashtable of size 2. And keep track of amount
@jwsoftwareАй бұрын
Good observation on not needing to track the number of 20s. Took me from beats 44% runtime, 90% memory to 84% runtime, 96% memory. I thought I was missing some totally different solution at first but had everything else right
@mrvinyllad25Ай бұрын
i made the same mistake, then the same observations lol. Thank you for you service, Navdeep!
@sjnapoles2484Ай бұрын
This is such a nice problem
@mohammedkaifullakazimАй бұрын
Even i got the wrong answer at first when I read the question and coded it, means adding 5 dollars and giving back the remaining amount but, when I went through the example and understood it clearly possibly taking 10 to 15 min then I coded it, obviously the answer was correct
@user-dp9gi1vg8rАй бұрын
always a calm chill day after a storm xD
@pastori2672Ай бұрын
please solve codeforces Increasing Sequence with Fixed OR 🙏
@kusumjoshi4613Ай бұрын
good explanation
@qulinxaoАй бұрын
class Solution: def lemonadeChange(self, z: List[int],a=0,b=0) -> bool: for x in z: if x==5: a+=1;continue a-=1;b+=15-x;(b
@MP-ny3epАй бұрын
Thank you for the daily!
@YegoryАй бұрын
Bruh I didn't realize I needed to serve customer from left to right (queue), I just interpreted it as having all the bills right away and just giving change in whatever order. So this didn't pass [5,5,5,5,20,20,5,5,5,5]. Now I see why! :D
@midhunskaniАй бұрын
Much more simple Solution class Solution: def lemonadeChange(self, bills: List[int]) -> bool: count_5 = 0 count_10 = 0 for bill in bills: if bill == 5: count_5 += 1 elif bill == 10: count_10 += 1 count_5 -= 1 if count_5 < 0: return False elif bill == 20: if count_10 > 0 and count_5 > 0: count_10 -= 1 count_5 -= 1 elif count_5 >= 3: count_5 -= 3 else: return False return True
@pranav2423Ай бұрын
Hey Neetcode, what drawing software do you use?
@leeroymlg4692Ай бұрын
paint 3D
@jasurbekyuldoshev2673Ай бұрын
Finally a problem in which I can breathe 😃
@limsiryuean5040Ай бұрын
I tried solving it using a dictionary, got stuck on trying to come up with a logic for the structure.
@Jk-ls7eyАй бұрын
I didn’t even think of dp or backtracking , i just did the same logic he did on my own. I don’t know i should be worried or not😭😭
@kartikgandhi7447Ай бұрын
Me too 😭, I am also confused how did they think of dp or backtracking. This makes me worried and not worried at the same time lol.
@pastori2672Ай бұрын
we're legit clones except when it comes to yesterday's problem
@user-tt3lb1yy6iАй бұрын
10:21 is the runtime stat chart glitched? It seems that no matter the percentage beat, it always lands in that crevice
@asagiai4965Ай бұрын
I see. The hidden clue on what the question is. Is found in the note. "Note that you don't have any change in hand at first". (in other words you cannot give change someone correctly if you don't have the correct money in the first place) I'm gonna also probably answer this the wrong way if I don't see the video and the note.
@31redorange08Ай бұрын
The problem would only be partially solvable if you didn't know how much change you had in the beginning.
@asagiai4965Ай бұрын
@@31redorange08 what does that even mean?
@31redorange08Ай бұрын
@@asagiai4965 How would you solve it without knowing how much change you had in the beginning?
@asagiai4965Ай бұрын
@@31redorange08 idk if you are not getting my comment. But it is impossible not to know your change Change = your money - the price.
@31redorange08Ай бұрын
@@asagiai4965 It seems like you're not understanding your own comment. You have to know how much money you have in the very beginning to know whether you can give everyone their change.