Mock Google Coding Interview with a Meta Intern

  Рет қаралды 869,682

NeetCode

NeetCode

Күн бұрын

🚀 neetcode.io/ - Get lifetime access to all current & future courses I create!
Checkout my second Channel: @NeetCodeIO
Today I gave a mock google coding interview to @FryingPan who is a former intern at Meta currently studying for coding interviews as he finishes up school. He also recently interned at Meta in NYC.
Btw this is the question I asked: leetcode.com/problems/insert-...
We actually solved it on the channel here: • Insert Delete GetRando...
🥷 Discord: / discord
🐦 Twitter: / neetcode1
📷 Instagram: / neetcodeio
🎵 TikTok: / neetcode.io
Time Stamps
0:00 - Intro / Background
1:45 - Interview Starts
2:45 - Clarifying questions
4:40 - Start coding
7:40 - Hint #1
11:15 - Suboptimal solution
16:35 - LIGHTBULB MOMENT
23:55 - Half time remaining
25:30 - Test cases
29:55 - Follow-up Question
36:55 - Bug bashing
39:13 - Disqualified for cheating
42:05 - Interview Complete
42:50 - Debrief
45:40 - Final Results
#google #coding #interview
google coding interview
coding interview
google interview
cracking the google interview
meta software engineer
facebook software engineer
software engineer interview

Пікірлер: 710
@NeetCode
@NeetCode Жыл бұрын
🚀 neetcode.io/ - Get lifetime access to all current & future courses I create! Should FryingPan mock interview me next? Thanks to FryingPan for joining, check out his video here: kzfaq.info/get/bejne/mLKbZZpe3bGldGQ.html Btw this is the question I asked: leetcode.com/problems/insert-delete-getrandom-o1/ We actually solved it on the channel here: kzfaq.info/get/bejne/oJp7qstz38-zoJs.html
@devstuff2576
@devstuff2576 Жыл бұрын
Wait, Google docs aren't used anymore???
@alisonoz7219
@alisonoz7219 Жыл бұрын
Yeah I'd like to see that 🤩
@zesanurrahman6778
@zesanurrahman6778 Жыл бұрын
I became homeless. I am depressed
@slayerzerg
@slayerzerg Жыл бұрын
yeees
@smtp_yurzx
@smtp_yurzx Жыл бұрын
It seems only fair and right with the world. I mean if you prefer balance in the universe rather than chaos.
@Dulandor
@Dulandor 2 ай бұрын
"If there is a problem, just throw a hashmap at it." - someone really smart
@subhrajyotisen7218
@subhrajyotisen7218 Ай бұрын
Funny how true this is
@user-wo8kh7cw4k
@user-wo8kh7cw4k Ай бұрын
@@subhrajyotisen7218 why not Hashset here ? until follow up question
@subhrajyotisen7218
@subhrajyotisen7218 Ай бұрын
@@user-wo8kh7cw4kthe code in this interview seems to be more pseudo code. When writing actual code, they will mostly have to to use hashset since Set is usually an interface in many languages and HashSet is one of the implementations
@nile7999
@nile7999 Ай бұрын
@@user-wo8kh7cw4k you need to store the index as the value.
@BTC500k
@BTC500k Жыл бұрын
“In your real interviews, do you talk the same way..?” LMAO that is the question I wanted to ask lol
@pinecedar180
@pinecedar180 7 ай бұрын
It was obviously a frank discussion between friends
@parvscripter
@parvscripter Ай бұрын
@@pinecedar180 but you can be pretty frank just don't be unprofessional
@decomush
@decomush Ай бұрын
I'm 5 min into the video and I wanted to ask that
@hariharanm9930
@hariharanm9930 Жыл бұрын
Hey Neetcode! I got the exact same question on my Adobe interview two days ago. Luckily I have been practicing from your collection of questions last few months and never missed any of your videos. I bagged my offer today!! You have literally made this happen for me. Can’t thank you enough for this day!
@onkarsingh-vu1ds
@onkarsingh-vu1ds Жыл бұрын
Hi, is adobe allowing remote work?
@SIAMEInekeidijdnen
@SIAMEInekeidijdnen Жыл бұрын
Congrats ma boi
@usa5450
@usa5450 Жыл бұрын
Congrats nigg*
@dv-89
@dv-89 8 ай бұрын
what collection of questions you are talking about? Neetcode 150?
@paultvshow
@paultvshow 2 ай бұрын
Hey man. I have been preparing for coding interviews for a month now. I am a self taught coder who is passionate about coding especially in AI and machine learning fields. I have just started coding for 3 months with hands on projects of over 50+ as I have quit my previous job and dedicated my full time learning coding. During the past weeks, I spent at least 4-5 hours a day on Leetcode and I have completed almost 100 problems. Now then I have started watching coding interview videos, and I feel that problems in most mock interviews seem a little too easy. So I just wanted to know from people like you who have already experienced real interviews that how difficult are there real problems?
@nikhil_a01
@nikhil_a01 Жыл бұрын
I find it funny that when he googled for how to get an arbitrary element from a set, he actually found Java code, and pasted it into his Python solution. And NeetCode is just like "great".
@malikau917
@malikau917 Жыл бұрын
😂
@user-lt6hz7jh2p
@user-lt6hz7jh2p 8 ай бұрын
I 😂😂😂
@NotNazuh
@NotNazuh 6 ай бұрын
😂😂😂😂😂😂😂😂😂
@geekzombie8795
@geekzombie8795 5 ай бұрын
Lel
@tabish-shakeel
@tabish-shakeel 2 ай бұрын
I didn't notice that, can anyone paste the timestamp. I watched the video twice still didn't see it
@free-palestine000
@free-palestine000 Жыл бұрын
please record more of these google mock interviews!! this questions seem so easy initially, but watching how frypan is talking aloud and saying his thought process makes me realize how the little details he says is actually valuable to you (neet) as the interviewer. now i realize why i failed my interviews so much
@danielbrown7534
@danielbrown7534 Жыл бұрын
Watch this i was thinking maybe we could store in an array..but wont store in array initially..we would then use a function to check the array if the value was already store there.. if yes then use the value position to store the new figure.. if no then use the new value as storage.. I would also use a function to get a random number using the array limitation then use that random number to return a value from set.
@ahsanmurtaza6185
@ahsanmurtaza6185 Жыл бұрын
@@danielbrown7534 That wouldn't meet the time complexity requirements.
@stefannita3439
@stefannita3439 8 ай бұрын
@@danielbrown7534 searching in an array is O(n). Unless the array is sorted, in which case you can use binary search and it becomes O(logn). But to be able to always search in O(logn) you have to maintain the sorted order of the array at all times, which means your insertion becomes O(n) (find the correct index to insert at to maintain sorted order: O(logn), insert and then shift all of the elements to the right of it: O(n)) and your removal is now also O(n) (typical array removal). The point of this question is to kind of juggle all of these limitations. Every time you choose a data structure to optimize one of the operations, something else becomes more expensive. Nothing is free. This is why the trick is to use different data structures simultaneously, each good at different operations, and figure out how to make them work together to create an interface where all three of the exposed operations are O(1). But even this isn't free, as you're now basically doubling the memory you use (still O(n) space tho).
@adolft_official
@adolft_official 6 ай бұрын
These interviews are Haram bro, start praying 5 times for FALSEtine and Stop using Jewish owned KZfaq as it funds Israel against your Allah
@tusharvyavahare9229
@tusharvyavahare9229 Жыл бұрын
for python folks, removing an item from set, which isn't in the set , using remove() method will result in error, so use discard() method.
@danielsank2286
@danielsank2286 Жыл бұрын
Just use pop
@yatintyagi4366
@yatintyagi4366 5 ай бұрын
or just use an if statement
@youMatterItDoesGetBetter
@youMatterItDoesGetBetter 2 ай бұрын
@@yatintyagi4366 wouldn't the if statement be more clear since the value isn't in the set to begin with? Thus if changed in the future... it'll still run correctly?
@sandeepreddy1286
@sandeepreddy1286 Ай бұрын
Agree smart move
@bit-learn
@bit-learn 20 күн бұрын
@@danielsank2286 pop removes a random value from the set, not the required one
@willboler830
@willboler830 Жыл бұрын
Gah, what people watching this might be missing out on is the anxiety, and the difficulty between coding and talking through the code. I sat here correcting him as he went, but also remembered how much I stumbled over trivial stuff. It's so nerve racking.
@asagiai4965
@asagiai4965 2 ай бұрын
True, IMHO I think he should ask all the possible questions. To ease the doubt.
@Neilblaze
@Neilblaze Жыл бұрын
Been watching Mock interview sessions for a long time, but this is by far the most enjoyable session for my all time :)
@rajingale5776
@rajingale5776 Жыл бұрын
The collab we waiting for..🔥 The only 2 coding channels i subscribed and getting that collab is awesome..
@Protocoding
@Protocoding Жыл бұрын
Things I'm starting to realize every developer needs to do during an interview. Ask tons of questions before even thinking about coding, even if they seem obvious. If the easiest way to think of a question is in one-time complexity odds are they are hinting at the complexity they want in the description of the question.
@MichaelButlerC
@MichaelButlerC 7 ай бұрын
I just hate to ask questions for the sake of asking questions though...
@eesnehhil
@eesnehhil 6 ай бұрын
@@MichaelButlerC frfrfr
@AnimeZone247
@AnimeZone247 10 күн бұрын
@@MichaelButlerCyou’re going to have to do that during the actual job
@SankarshanGhosh
@SankarshanGhosh Жыл бұрын
This is the first time I watched a 40 minute video. Real fun, we want more of these!
@krovvidisupraja6822
@krovvidisupraja6822 Жыл бұрын
Thanks so much @NeetCode for doing this. I think this video is pretty realistic (except for the way @FryingPan talks 😂) compared to the other mock interview videos online! Helped me relate a lot being an interviewee. Looking forward to more such videos!! Keep inspiring with your good work 😃
@davidtran9455
@davidtran9455 3 ай бұрын
well did you get the job?
@adityasankhla1433
@adityasankhla1433 5 күн бұрын
@@davidtran9455 😭
@jasonswift7468
@jasonswift7468 Жыл бұрын
This is a really inspring mock interview. Learn a lot from this standard mock interview. Please upload more similar interviews including system design mock interview.
@axaxaxaxaxaxax33
@axaxaxaxaxaxax33 Жыл бұрын
the collab i didnt know i need 😂 frying pan is too funny lol. Great hint from Neetcode too, just enough to nudge him into revelation
@MrPkmonster
@MrPkmonster Жыл бұрын
That's cool. I've learned a lot during the Mock test interview. Understand deeply the way the interviewer asked the candidate and the way of thinking to solve the problem.
@dacattilearnsenglish3141
@dacattilearnsenglish3141 4 ай бұрын
There were 4 people in my coding interview a few months ago. They were quite friendly with me, though. I had to code C++ in MS Word, which was a pain the neck. Even the easiest questions become hard because of tension. In addition to that, time flies when you are under pressure because you are trying to come up with an answer in your head and trying to word it properly.
@supastazz
@supastazz Жыл бұрын
That adding array to value for duplicate values was amazing, always had that doubt but I found the answer today. Thank you for the post
@srinadhp
@srinadhp Жыл бұрын
Invigorating! Great questions all around, even greater thoughts and solutions!
@MikeKm-hd1ve
@MikeKm-hd1ve 2 ай бұрын
Priceless video!! Thank you so much!!
@atalaramadhan9313
@atalaramadhan9313 Жыл бұрын
The collab I was waiting for years. You guys are prob my fav swe youtubers
@atharvagupta9355
@atharvagupta9355 Жыл бұрын
This interview made me realize that I can do it too. Thanks, Neetcode
@heatchecknyc2142
@heatchecknyc2142 Жыл бұрын
Enjoyed this video so much i watched on both your channels. Can you make a series of this?
@varshasingh1299
@varshasingh1299 Жыл бұрын
Big fan of neetcode ❤️ just want to thank for all the amazing content you post in your channel... Thank you 🙏 love from India
@ztrixx3280
@ztrixx3280 6 ай бұрын
this was really informative and fun at the same time. thanks NeetCode.
@basma-ba
@basma-ba Жыл бұрын
So useful and so fun session. thank you for this video, it relaxes me somehow while hearing the layoff news
@marspark6351
@marspark6351 Жыл бұрын
Theres something neither of you caught. When you remove elements from the set that keeps track of indices and when there's only one element in the set, you are left with an empty set. What you want is to get rid of the map entry altogether. So you should check if it's the last element, and if it is, del that entry. Also, he mentions changing to a set instead of an array because when he chose the array first, he was using the first index and then he probably thought "wait.. now if I delete the first index I have to shift all the remaining ones to the left". Well actually you can simply use the last one instead of the first by using "pop", and so you can still use the array
@christiancepeda5457
@christiancepeda5457 Жыл бұрын
excellent observation
@ProfessorQuality
@ProfessorQuality 7 ай бұрын
what if you want to remove the number first in the list, you can't use pop() instead?
@xingzheli7431
@xingzheli7431 7 ай бұрын
It's remove by value, so it's worst-case linear time for an array.
@Biggyweezer69
@Biggyweezer69 4 ай бұрын
@@ahmadelmassalkhi This actually isn't true. since we are only ever pushing values into the values array, the index of the last value in the value array will always be the last index in that values index array. This stays true whether there are duplicate last values or not. Using a set here isn't better really.
@ahmadelmassalkhi
@ahmadelmassalkhi 4 ай бұрын
​@@Biggyweezer69 I realized I was digging deep, while even the obvious case of having a duplicate of the last element, it raises an error (in the final code of the guy in the video)
@RaghavRathi-qb8fr
@RaghavRathi-qb8fr 10 ай бұрын
This is prolly the best channel out there for ds algos!!!
@karanbhatia2834
@karanbhatia2834 Жыл бұрын
This was like actually really awesome. I felt like I was solving the problem with him!
@house0795
@house0795 Жыл бұрын
Awesome, more of that would be highly appreciated
@TiagoDiass2
@TiagoDiass2 7 ай бұрын
amazing content guys, loved it!
@brainesteven6365
@brainesteven6365 Ай бұрын
in the 30:28, the follow up question is to allow array to store duplciate. The follow up seems to be simplified, in general, it may ask while allowing to store duplicate values, what is to make each number to has the same probility in getRandom(say 1,2,2,2,2,2,3), 1 and 2 and 3 has the same 1/3 probility to be returned.
@SankHar4
@SankHar4 Жыл бұрын
Neet code Please do conduct whenever possible it helps the everyone a lot of Learning. Thank you so much...
@tedwoldeselassie5715
@tedwoldeselassie5715 7 ай бұрын
I would implement the Get(bool random, Enum input) first, then when implementing the Insert, pass each iteration to Get() with random false. If it returns a value then dont insert it as its duplicate. To get random you jusst need to set random to true. Then the remove is straight forward.
@denhoward6438
@denhoward6438 Жыл бұрын
Nice video, I can feel the pressure of the interviewee by his word and face
@SanjanaSingh-mc6re
@SanjanaSingh-mc6re Жыл бұрын
Can we get more interviews like this one? It was really helpful. Thanks!! 🙂
@heretic7135
@heretic7135 Жыл бұрын
??
@davidkolesom
@davidkolesom Жыл бұрын
Love this Mr. Neet Code!
@creamymain7867
@creamymain7867 4 ай бұрын
Love the "Now let me ask you another question" at the beginning haha. Very inciteful video btw
@christianmorera4127
@christianmorera4127 Жыл бұрын
I love this, frying pan makes coding interviews fun
@utsabkhakurel9742
@utsabkhakurel9742 7 ай бұрын
In the follow-up, you could have just chosen the last element from the list to swap self.map[value][-1] and used pop() to remove it after the swap.
@yosup7563
@yosup7563 Ай бұрын
There is no indexing in sets so self.map[value][-1] wouldt work and then he also pasted some wrong java code in
@chengyuanchang4000
@chengyuanchang4000 Жыл бұрын
The code in follow up has a bug... In the remove function, when the size of self.map[value] equals to zero, we need to delete the empty set like `del self.map[value]`. Otherwise, next remove call for same element will cause an error.
@isaiahparadiso8044
@isaiahparadiso8044 Жыл бұрын
Pro tip to people interviewing. Don’t talk like this guy. Don’t swear. Don’t quiz the interviewer. Finding the optimal solution is a must, but they’re also deciding if they want to work with you. Some crude banter can give the wrong signal, and there’s zero advantage to you in risking it. Be polite. Don’t be cocky. Every grading rubric has score around cultural and team fit. Just FYI.
@DC-yw5yg
@DC-yw5yg Жыл бұрын
FUC.K
@myrtiy
@myrtiy Жыл бұрын
Neetcode’s code is neat! Thank you Neetcode!
@pokatana4130
@pokatana4130 Жыл бұрын
Nice video. Love to see more so I can prepare.
@chenbi5258
@chenbi5258 Жыл бұрын
OMG, very impressed by this solution.
@cowaiicow8802
@cowaiicow8802 Жыл бұрын
I never thought i needed this collab until now...
@zweitekonto9654
@zweitekonto9654 Жыл бұрын
You never know what u need until its too late. Thats why ur broke.
@yitongxie6574
@yitongxie6574 Жыл бұрын
the last part you ask 'do you talk like this in real interview?' and then 'nothing' really make me laugh
@applepine3172
@applepine3172 3 сағат бұрын
17:55 When he realized what's the right way, and you see the smile, that's why we love programming. That's why ones, who think "I want to be a programmer because it means I get a lot of money" always fail. Whoever loves this, feel fun when programming is always the one who reaches his goal.
@jonTheDon28
@jonTheDon28 5 ай бұрын
None of my coding interviews for internships have been anywhere near this easy
@harryzhu
@harryzhu 4 ай бұрын
but the mock interviews from faang are - its a mock not a real assessment- its used to get a feel for the format and UMPIRE application
@YSTYG
@YSTYG Жыл бұрын
I thought we were about to get a face reveal 😂
@NeetCode
@NeetCode Жыл бұрын
Maybe on part 2... lol
@somakkamos
@somakkamos Жыл бұрын
Seriously man..i so badly want to see neetcode.. in my mind he is like moriarty frm sherlock show... coz thats how brilliant neetcode is.😊😊😝
@josepha8415
@josepha8415 Жыл бұрын
@@NeetCode Is Techlead in the thumbnail
@joshuabiyinzika2834
@joshuabiyinzika2834 Жыл бұрын
Me too..neetcode, make it happen!
@skyhappy
@skyhappy Жыл бұрын
Neetcode looks like an angel for sure
@CarInLot
@CarInLot Жыл бұрын
Love this new content.
@imbes64
@imbes64 Жыл бұрын
pretty decent easy-med level q to ask, will use in my own new hire interviews as it makes for good discussion!
@salvadorortiz449
@salvadorortiz449 Жыл бұрын
Something important is the use of descriptive names for your variables, because in this case without any previous context you won’t figure out what’s the function of “map” or “values”variables.
@mannyb096
@mannyb096 10 ай бұрын
thats actually a great point! I guess in this case what kind of variable names would you use? Bcuz i cant think of what to call them other than values either lol
@hydromaniac7117
@hydromaniac7117 4 ай бұрын
@@mannyb096 removedInt
@k.i.r.a_619
@k.i.r.a_619 Жыл бұрын
This guy is total tech lead material
@5pellcast3r
@5pellcast3r Жыл бұрын
The collab I didn't know I needed ..... 🙃
@LeSpaceCroissant
@LeSpaceCroissant 9 күн бұрын
My man was coding in Python and searched how to get the first element of a set in Java. Genius. And he said it so confidently too: "I got it sir! I got it!" 39:25 😂 It's "next(iter(mySet))" by the way. And thank you for the video, it was really nice!
@koch9666
@koch9666 Жыл бұрын
Omg that was so fun I really enjoyed the vid and it's perfect too because I have a final round coding interview later this week! You guys should collab more often, that would be such good content!
@shafaitahir4728
@shafaitahir4728 Жыл бұрын
How did it go?
@harryshi1
@harryshi1 Жыл бұрын
love the concept, if you need another person to mock interview I would be happy to do one. I am an ex Quant trader now studying for algo / CS jobs.
@ahmedanwer6899
@ahmedanwer6899 7 ай бұрын
Are ya still down? :)
@andreainvernizzi8510
@andreainvernizzi8510 Жыл бұрын
So many headaches to end up in a cubicle Monday to Friday. May as well deploy this knowledge to develop independently and get all the benefits.
@jemanuelg99
@jemanuelg99 Жыл бұрын
Im not sure if the rudeness was real or satirical. I’m not sure if being rude to the interviewer is a great strategy.
@tyeezy5460
@tyeezy5460 Жыл бұрын
Language barrier maybe? But prob satire
@jose6378
@jose6378 Жыл бұрын
Unironically got a very similar question for Amazon SDE position
@negarvahid3429
@negarvahid3429 Жыл бұрын
Bro why didn't you upload this sooner I had my interview yesterday :,)
@cenchang3765
@cenchang3765 7 ай бұрын
So funny. I am still struggling with leetcode by just finishing the first 200. And I did not have much interview experience. The video makes me feel like we are all human beings.
@ilovemeee21
@ilovemeee21 Жыл бұрын
More of these please !!!!!
@charminghostes
@charminghostes 6 ай бұрын
hey hey dude, thanks for the vidos!! now a cool mood for the whole day :)))
@mpi3602
@mpi3602 Жыл бұрын
I think the end solution doesn't consider removing a value from a map that has only one index
@user-wd1yj6vq7t
@user-wd1yj6vq7t 6 ай бұрын
Funniest, energetic interview I have ever seen , I want confidence like this😅🤣
@codealonewithGod
@codealonewithGod Жыл бұрын
I am happy to know I almost guessed all the approach correctly!!
@GinjouArmy
@GinjouArmy Жыл бұрын
Glad I could follow along with the code on the white Goggle Doc.
@noomade
@noomade 7 ай бұрын
This was fun. Never seen someone so pleased to get the answer :P
@mr.rodzhers8663
@mr.rodzhers8663 6 ай бұрын
Well shown who is a front-end developer, thanks
@MightyElemental
@MightyElemental Ай бұрын
got my first interview on wednesday and this video equally relaxes and terrifies me 😅 Trouble is I cannot think aloud. I can think, then explain, but that takes more time. Hopefully not an issue, but we shall see 🤞
@user-ot4zl1ii2z
@user-ot4zl1ii2z Жыл бұрын
Can I ask if it is possible to use Built-in functions from the built-in datatructures in coding interviews, as what he used map.add() and map.remove() in the first problem? I thought it is required to create your own efficient functions except the Random Functions.
@jphamlett
@jphamlett Жыл бұрын
You can always ask, interviewers are looking for specific things. Most are just to see how you think not that you can regurgitate a solution
@charleslatrom7658
@charleslatrom7658 Жыл бұрын
Using built-ins are fine if there's more to the question. If the question was implement an efficient class which supports add and remove whilst omitting duplicates, then delegating to a Set would not be appropriate as they would be looking for you to design your own Set class (or similar). However you would not be asked that in an interview (unless you're going for L6+ at Google in a language-design role, e.g Guava team, Core Java Libraries, etc)) as the Map, Set, etc classes are extremely complex to write from scratch in 35 minutes.
@janni7439
@janni7439 Жыл бұрын
Those sort of questions are a little bit odd, because the "reduce complexity" always boils down to the data structure behind and there basically a lot of useful stuff was already invented, so you wouldnt hire someone, who can recreate such a structure from scratch, because that's totally not part of the daily business.
@bit-learn
@bit-learn 20 күн бұрын
please @NeetCode if your are watching .. so on the first part my approach was to solve everything through set as set gives everything like adding, remove with num and generating a random number from set (we can add it again on the next line) plus on the second part where duplicates are allowed .. we can change it to hashmap so that on removing if the values aren't zero we can just remove the iteration count of the numbers or pop the number otherwise when iteration count goes 0. need help in clarifying it .. thanks for experience though
@Y2B123
@Y2B123 Жыл бұрын
Should we delete empty value-indices pairs from the map as we are removing? It seems to me that leaving empty sets around not only waste space but also breaks the if statement above.
@MRTNWSS
@MRTNWSS Жыл бұрын
I agree.
@marspark6351
@marspark6351 Жыл бұрын
Yes. That's something they missed
@JoaoPereira-if5jk
@JoaoPereira-if5jk 26 күн бұрын
Awesome video! Quick question: What's the point of changing the last item of the array to the value to be deleted if you're just going to pop it anyway? Can't we just remove that extra step?
@paulofelipe2780
@paulofelipe2780 26 күн бұрын
Another important question that could have been asked is the range of possible values to be inserted, it can influence a lot the final solution complexity!
@flothus
@flothus Жыл бұрын
Good parts: Asked good questions. Voiced thought process. Provided good test cases. Could recover from bugs. Could make use of hints. Solved the assignment. Not so good and red flags: Too focused on how to ace the coding part instead of making a good impression as a team player. Some unnecessary code. Raised voice and tried to school the interviewer to cope with pressure. Didn't act humble and didn't seem very interested in reflection after the interview, instead was more interested in competition and returning a "hard" question. Also foul language and improvable attitude and composure. Might be just acceptable in a youtube interview but would have been much better without that! Thanks to both for the video!
@federicopessina974
@federicopessina974 Жыл бұрын
very useful and well designed website NC!
@schnitzel_crumbs
@schnitzel_crumbs Жыл бұрын
You mentioned that you don’t actually use Google docs for coding interviews? What do you use a Google IDE? How do you draw out solutions on a Google online interview?
@SiddhantDubey
@SiddhantDubey Жыл бұрын
it's not exactly "Google docs" but it's basically the same thing, just with syntax highlighting and no autocomplete (or there wasn't when I interviewed)
@t_regbs
@t_regbs Жыл бұрын
yea its kind of a modified version of google docs (at least that's what it looked like) with syntax highlighting
@showbhik9700
@showbhik9700 Жыл бұрын
Hey, Neetcode! Lovely video. Just want to say your videos helped me a lot during my interview prep for Google. While I couldn't make it there, I definitely learnt a lot. PS: I work with Amazon now 😉
@von...
@von... Жыл бұрын
regarding the large layoff rumors: based on your experience there so far (& especially with how its been recently), will new-grad hiring essentially be frozen & it'll be a moot point for me to go hard on getting an interview there?
@showbhik9700
@showbhik9700 Жыл бұрын
@@von... Depends on the org for which you will be selected. There are specific orgs who are getting the axe because the leadership overestimated their growth. For orgs like AWS, Whole Foods, Prime, Go, which is commodity based and have real demand, the layoffs have not been done.
@showbhik9700
@showbhik9700 Жыл бұрын
​@@ashiqhussainkumar1391 I am sorry about that man. I hope you get your call soon
@RohitMenon6899
@RohitMenon6899 Жыл бұрын
set() doesn’t have iterator() attribute right so the way he gets the first value of the set in the remove function won’t work. Correct me if I’m wrong
@CrazyMutex
@CrazyMutex Жыл бұрын
We can use array to store elements. But we can also keep tracking it's size. And when an element should be removed, we can assign it to the last element, like a[i] = a[n-1] and decrease n like n-=1
@elevenkb-uj9xh
@elevenkb-uj9xh 10 ай бұрын
How would this deal with duplicates?
@SaltyBoi420
@SaltyBoi420 6 ай бұрын
​@@elevenkb-uj9xhlinear search would work but time complexity will be fucked up😂
@sriharisrinivasan5108
@sriharisrinivasan5108 4 ай бұрын
how did I get this recommended just before the daily leetcode question became this today
@chrisrey2516
@chrisrey2516 2 ай бұрын
i was able to come up with similar solution. I'm happy lol. I was thinking along with him
@Adham-gh1pg
@Adham-gh1pg Жыл бұрын
Theres no need for a map the set was fine. He just needed an array where he would add [0,1, 2... etc to it every time a value is inserted and he can make sure that hes not inserting a duplicate by checking if the value is in the set to begin with which also takes O(n) and when he comes to do the get random he passes in the list of indexes [0,1,2...,n] (n being the length of the set) and then he can get the random from the set by doing set[result of random]. Let me know if this makes sense to anyone.
@yskida5
@yskida5 Жыл бұрын
Great collab!
@ProfB27
@ProfB27 Жыл бұрын
I think we should use doubly LL to store the elements and hash map to store key as number itself and reference of the element as value. Removing adding, checking existence all are O(1), get random will now have list of keys.
@yessirski7868
@yessirski7868 7 ай бұрын
how would you create that?
@utkarshpandey6244
@utkarshpandey6244 6 ай бұрын
I also thought of the same solution and was expecting that approach to be discussed
@BIELSIMON
@BIELSIMON 6 ай бұрын
Get random would be O(n) if you assume you don't have keyAtIndex in a hashmap, which is the assumption they are making because if you can all you need is a single hashmap (for example a C++ unordered map using .at(idx))
@guitargeorge7255
@guitargeorge7255 6 ай бұрын
thought of that too, but you still have trouble and need to use the realization in the video
@anonymoussloth6687
@anonymoussloth6687 Жыл бұрын
Can you explain the follow up with allowing duplicates. I didn't understand that
@Ripred0219
@Ripred0219 Жыл бұрын
The snarky comments while Neetcode remained mute was hilarious
@Entropy67
@Entropy67 Жыл бұрын
Couldn't the inital problem of get_random being o(n) be resolved by using the keySet() method of the hashmap? This would return a list of the keys of which we could then choose a random one based on its index, and then we would return the value in the hashset at a key: return self.map.get( random.choice(self.map.keySet())) from what I know im pretty sure hashmaps usually store a key list regardless so this should all be o(1)... ?
@eakishway
@eakishway 3 ай бұрын
Exactly. (keySet is called keys in Python.)
@sajitullahkhan
@sajitullahkhan 6 ай бұрын
Bro please make more these kind of coding interview videos
@dyanosis
@dyanosis Жыл бұрын
You can make a random choice in O(1) by generating a random index between 0 and the length - 1 of the map (since trying to get the value at map[length] would be an error). Nor sure why he's wasting time adding things to a set and a values array when you just need the set.
@marspark6351
@marspark6351 Жыл бұрын
Do the indices get rearranged when you remove an element from the map? I think that's what they were worried and unsure about. I would be interested in how the map would remove in O(1) if they do shift all the indices when something is removed
@anantmk6994
@anantmk6994 4 ай бұрын
Exactly what I thought. A simple python set() performs all the three functions in o(1) time as the pop() already gives a random number everytime. Isn't it?
@idontseeit
@idontseeit 3 ай бұрын
could you use 2 hash maps? one that maps values to indexes, and one that maps indexes values? that way we can just generate a random integer from the index hash map and use that to get the corresponding value from the value hash map
@lilygranger6264
@lilygranger6264 Жыл бұрын
OMG my two favorite youtubers!!!
@BiboSBA77
@BiboSBA77 7 ай бұрын
Wasn't assignment of self.values[-1] = value useless as he will be removing in after few lines without using it at all? I also am not sure whether the hypothetical getRandom.choice function can except either an array or a set. (Not sure whether they are the same in python, as they are not in JS and that's what I am familiar with)
@eakishway
@eakishway 3 ай бұрын
In Python, random.choice only accept non-empty sequence, and set is not a sequence.
@tune6000
@tune6000 Жыл бұрын
Do more of these
@algoevodevo
@algoevodevo Жыл бұрын
Is there any difference between, x = 22 and y = [22], in terms of space complexity?
@user-fp4dr1ne7z
@user-fp4dr1ne7z Жыл бұрын
But for real, if you act like him in an interview, how would the interviewer view that? Is he being cocky? Or is that confidence? I understand he’s being semi sarcastic because that’s his KZfaq persona. But I know there are people who actually act like this in interviews and I wonder how it’s received by the interviewer.
@devstuff2576
@devstuff2576 Жыл бұрын
Badly
@FryingPan
@FryingPan Жыл бұрын
Assert your dominance. Instantly hired.
@devstuff2576
@devstuff2576 Жыл бұрын
They discuss in the end and you can see it's not a good idea ofcourse
@Mechaneer
@Mechaneer Жыл бұрын
"I bet you didn't know that!" 🤦🏼‍♂️
@RocketPropelledWombat
@RocketPropelledWombat Жыл бұрын
@@FryingPan Should I raise the stakes by urinating on the interviewer's leg?
How to use Leetcode in 2020
11:07
NeetCode
Рет қаралды 93 М.
React Junior Developer Interview (Questions & Challenge)
1:06:19
Cosden Solutions
Рет қаралды 103 М.
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 94 МЛН
Cute Barbie gadgets 🩷💛
01:00
TheSoul Music Family
Рет қаралды 72 МЛН
I quit Amazon after two months
10:09
NeetCode
Рет қаралды 561 М.
How I Failed the Google Coding Interview (and lessons I learned)
14:24
a day in the life of an engineer working from home
8:42
Joma Tech
Рет қаралды 20 МЛН
Advice from the Top 1% of Software Engineers
10:21
Kevin Naughton Jr.
Рет қаралды 3,2 МЛН
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 500 М.
Google Coding Interview With A Facebook Software Engineer
49:59
Clément Mihailescu
Рет қаралды 919 М.
Software Engineering Job Interview - Full Mock Interview
1:14:29
freeCodeCamp.org
Рет қаралды 1,2 МЛН
Google system design interview: Design Spotify (with ex-Google EM)
42:13
IGotAnOffer: Engineering
Рет қаралды 971 М.
Winning Google Kickstart Round A 2020 + Facecam
17:10
William Lin
Рет қаралды 9 МЛН