8:00 I have done 210 leetcode and cant miss one of your vids. You just make the problem enjoyable
@aanishas19252 ай бұрын
so true!
@yang58432 ай бұрын
I overcomplicated this problem, I thought this was going to be a harder version of coin change
@deepakjain44812 ай бұрын
It was mentioned a easy question
@DNKF2 ай бұрын
LC made my day finally!
@rahulsbhatt2 ай бұрын
Thanks I didn't thought of them as bills and just calculated based on balance, I have to read the questions carefully.
@aanishas19252 ай бұрын
4:31 well, you read my mind
@mrvinyllad252 ай бұрын
i made the same mistake, then the same observations lol. Thank you for you service, Navdeep!
@jwsoftware2 ай бұрын
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
@Abdul_Rahman032 ай бұрын
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.
@Munchen8882 ай бұрын
It’s convenient to have a hashtable of size 2. And keep track of amount
@qulinxao2 ай бұрын
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-ny3ep2 ай бұрын
Thank you for the daily!
@sjnapoles24842 ай бұрын
This is such a nice problem
@mohammedkaifullakazim2 ай бұрын
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
@АльбусДамблодр2 ай бұрын
always a calm chill day after a storm xD
@Yegory2 ай бұрын
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
@pranav24232 ай бұрын
Hey Neetcode, what drawing software do you use?
@leeroymlg46922 ай бұрын
paint 3D
@midhunskani2 ай бұрын
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
@kusumjoshi46132 ай бұрын
good explanation
@jasurbekyuldoshev26732 ай бұрын
Finally a problem in which I can breathe 😃
@pastori26722 ай бұрын
please solve codeforces Increasing Sequence with Fixed OR 🙏
@Jk-ls7ey2 ай бұрын
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😭😭
@kartikgandhi74472 ай бұрын
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.
@pastori26722 ай бұрын
we're legit clones except when it comes to yesterday's problem
@limsiryuean50402 ай бұрын
I tried solving it using a dictionary, got stuck on trying to come up with a logic for the structure.
@user-tt3lb1yy6i2 ай бұрын
10:21 is the runtime stat chart glitched? It seems that no matter the percentage beat, it always lands in that crevice
@asagiai49652 ай бұрын
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.
@31redorange082 ай бұрын
The problem would only be partially solvable if you didn't know how much change you had in the beginning.
@asagiai49652 ай бұрын
@@31redorange08 what does that even mean?
@31redorange082 ай бұрын
@@asagiai4965 How would you solve it without knowing how much change you had in the beginning?
@asagiai49652 ай бұрын
@@31redorange08 idk if you are not getting my comment. But it is impossible not to know your change Change = your money - the price.
@31redorange082 ай бұрын
@@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.