When you ever stuck in a problem just throw a hashmap 😄
@tanmaymishra11092 жыл бұрын
Agree😁
@rahmaniastrid2 жыл бұрын
hey neetcode, just want to let you know that I got an offer from a FAANG company after months of rigorously going through problems and watching your vids to clear up confusion when I got stuck. Personally I found that your explanations are the best, you don't just talk code but you talk about the underlying concepts (and explaining them with clear drawings are a HUGE BONUS) which most of other youtubers kind of skip. I can't thank you enough, keep up the good work! Your work will help many people I am so sure of it. I still have another set of interview with another FAANG company, hopefully I'll whichever company I'll end up with will be the best choice. So you bet I will still grind your vids for the foreseeable future (and onwards of course). Cheers!
@AmanNidhi2 жыл бұрын
what was your language of choice
@Pegasus02Kr2 жыл бұрын
Took about 1.5 months to walkthrough all your Coding Interview Solutions playlist. I really appreciate for all your works!
@SkyeTian2 жыл бұрын
Simplified a little bit : import collections class FreqStack: def __init__(self): self.count = {} self.groups = collections.defaultdict(list) def push(self, val): self.count[val] = self.count.get(val, 0) + 1 self.groups[self.count[val]].append(val) def pop(self): result = self.groups[max(self.groups.keys())].pop() self.count[result] -= 1 if self.groups[max(self.groups.keys())] == []: self.groups.pop(max(self.groups.keys())) return result
@venkatasriharsha42272 жыл бұрын
There are no words to tell how beautifully u put these videos so simple. Finally got a decent product job. I would love to watch neetcode even if I grow older ❤. Keep posting the videos
@priyanshupriyam1743 ай бұрын
Thanks Neetcode for making this problem simpler for me!
@suhailf50142 жыл бұрын
You make me fall in love with Coding! Many many thanks :) Keep up the good work please ;p
@victoriac72572 жыл бұрын
I always feel released when I got stuck in a problem but found out that you have posted a video solution on it. Thanks NeetCode!! Keep going!!!!
@consistentthoughts8262 жыл бұрын
This one idea of maintaining stack ( stack = valcnt : [1,2,3] ) saved me. Thanks great solution
@ChandraShekhar-by3cd2 жыл бұрын
Thanks a lot for such a great explanation. Love from India ♥
@vdyb7452 жыл бұрын
Dude !!! You are a leetcode GOD !!!! Fantastic visual explanation and code. Thanks !
@KishoreKumar-ve1xb2 жыл бұрын
If I get a job in the future..... It's 100 percent because of NeetCode! Thank you So much and Congratulations for 100k subscribers You deserve it because you have the best video explanations on the entire internet....btw this is probably the Easiest Hard problem I've ever seen
@simonbabatunde43332 жыл бұрын
"Easiest hard problem" because it's been solved already. You can only say that if you sit at it to implement yourself.
@KishoreKumar-ve1xb2 жыл бұрын
@@simonbabatunde4333 I solved it before the video dropped because it was a daily challenge problem for March 19th. I can see why it can look complicated ...... the first thing that comes to mind is to use heaps.... but the simplest way turned out to be the optimal solution. I'm pretty sure I've seen a similar problem before.
@KishoreKumar-ve1xb2 жыл бұрын
I found the similar problem from my spreadsheet. 347. Top K Frequent Elements.
@somakkamos2 жыл бұрын
neetcode is like the rachel maddow of all tech youtubers...... best explainer everrrrrrr...
@hanklin46332 жыл бұрын
I like this one where you focus on the thought process to find the solution
@masternobody18962 жыл бұрын
me as an unemployee year 3 day 25. amazing video. i wonder how long it will take a job at fang
@NeetCode2 жыл бұрын
i know you'll make it buddy 🥲
@Colls-m8i2 жыл бұрын
@@NeetCode how long did it take you?…starting this interview questions journey myself…feels dreadful. What do you think of first whenever you face a problem that looks impossible to solve? What one thing do you always do in yr thinking approach to these questions?
@heathens28672 жыл бұрын
@@Colls-m8i if you'll practice coding regularly just 3 hours each day for like 6-7 months. You gonna ace normal startup interviews and if you'll continue so for next 9-12 months. You'll ace good product based company easily. Not sure about Google but definitely a good company. I just got a job in Adobe.
@vadimkokielov21732 жыл бұрын
I don't think you need to keep track of the maximum. A frequency can only ever be incremented (increased by one). Thus the maximum frequency can only ever rise by one. Thus it is enough to keep an array, indexed by frequency-1. Its size is then the maximum frequency.
@Dezdichado10002 жыл бұрын
there is something between this problem and a Young Tableux now that the final structure is revealed to be this stack of lists of decreasing heights.
@VarunMittal-viralmutant2 жыл бұрын
My implementation, I find it one more intuitive :) --------------------------------------------------------- class FreqStack: def __init__(self): self.c = count(0) self.pq = [] self.freq = defaultdict(int) def push(self, data): self.freq[data] += 1 heapq.heappush(self.pq, (-self.freq[data], -next(self.c), data)) def pop(self): while self.pq: _, _, d = heapq.heappop(self.pq) self.freq[d] -= 1 return d raise KeyError("pop from empty cache")
@hanklin46332 жыл бұрын
Man how do you keep up uploading these even while working at google. But good job keep up the good work, I'm still trying one day I may also pass the google interview.
@ChenAubrey2 жыл бұрын
Wow, Now you're in the Daily Challenge. Thank you for great video
@janardannn5 ай бұрын
wow thats a really creative solution
@nw3052 Жыл бұрын
Perfect explanation
@saijayavinothtvs25882 жыл бұрын
Heap will work, just keep the heap index of a valand update its freq and do top to bottom and bottom to top...
@narayanavasisthakandarpa962 жыл бұрын
Very good solution
@kousthubhtadanki12372 жыл бұрын
superb explanation
@ShivangiSingh-wc3gk2 жыл бұрын
Yes, thought of the heap solution n(log n) -> O(n^2) worst case :(
@akashverma57568 ай бұрын
HashMap is jack of all trades.
@weishin2 жыл бұрын
Can you take a look at some of the questions that Meta gives on their career pages?
@jchakrab2 жыл бұрын
I need a confirmation from you on height vs depth of a binary tree...for the height the base condition is "if not root: return -1" and for depth it is "return 0" right ?? when you search on google for height of a binary tree you will see both cases as valid answer...i am a bit confused could you please answer this. Height of null tree is -1, height of a single node is 0, right ?
@TheElementFive2 жыл бұрын
Enjoyable problem and nice explanation!
@rjarora6 ай бұрын
You are awesome man!
@MrSugar512 жыл бұрын
Hello NeetCode, Thank you for your great work. I’m just curious about what software you are using for drawing explanations and screen recording because I need to make the same kind of videos for my friends.
@NeetCode2 жыл бұрын
I use Paint3D with a mouse, and Streamlabs OBS for screen recording.
@MrSugar512 жыл бұрын
@@NeetCode thank you very much. The streaming software is what I’ve never come up is. I appreciate it. Just fyi I was surprised that you’re using Windows instead of Mac
@fia65592 жыл бұрын
What do you think about AlphaCode?
@pranavsharma74792 жыл бұрын
bro also share tips to prep for faang from where to do word problems to clear first round
@vdyb7452 жыл бұрын
What shortcut did you use to change stack to stacks ? I am able to do the multi-cursor operation in vscode but not in stackoverflow editor
@ParthShirawala2 жыл бұрын
Thanks for the help mate
@mdilyaspasha27362 жыл бұрын
Sir Please make videos java problems
@Douglasfaparanhos2 жыл бұрын
Very smart 👏👏
@marshallshao2 жыл бұрын
Hi man, I really like your video.. Unfortunately, I got rejection letter from Google yesterday.. Now I am really frustrating. :( Even I solved the problem during interview..
@marshallshao2 жыл бұрын
I just wanted to say THANKS!
@nguessaneric98302 жыл бұрын
Was it the phone interview?
@marshallshao2 жыл бұрын
@@nguessaneric9830 No, The first round of coding interview
@vantran3212 жыл бұрын
Just copped that Patreon 10 pack fam. It's peanuts next to your Google salary but enjoy a coffee on me
@NeetCode2 жыл бұрын
Thank you so much!!! I really appreciate it!
@somith162 жыл бұрын
What projects did u put while applying for job interview at google