Mock Google Coding Interview with a Meta Intern
Vložit
- čas přidán 14. 05. 2024
- 🚀 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 - Věda a technologie
🚀 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: czcams.com/video/bLk27-xKAD0/video.html
Btw this is the question I asked: leetcode.com/problems/insert-delete-getrandom-o1/
We actually solved it on the channel here: czcams.com/video/j4KwhBziOpg/video.html
Wait, Google docs aren't used anymore???
Yeah I'd like to see that 🤩
I became homeless. I am depressed
yeees
It seems only fair and right with the world. I mean if you prefer balance in the universe rather than chaos.
"If there is a problem, just throw a hashmap at it."
- someone really smart
Funny how true this is
@@subhrajyotisen7218 why not Hashset here ? until follow up question
@@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
@@user-wo8kh7cw4k you need to store the index as the value.
“In your real interviews, do you talk the same way..?” LMAO that is the question I wanted to ask lol
It was obviously a frank discussion between friends
@@pinecedar180 but you can be pretty frank just don't be unprofessional
I'm 5 min into the video and I wanted to ask that
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".
😂
I 😂😂😂
😂😂😂😂😂😂😂😂😂
Lel
I didn't notice that, can anyone paste the timestamp. I watched the video twice still didn't see it
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.
Just use pop
or just use an if statement
@@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?
Agree smart move
@@danielsank2286 pop removes a random value from the set, not the required one
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
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.
@@danielbrown7534 That wouldn't meet the time complexity requirements.
@@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).
These interviews are Haram bro, start praying 5 times for FALSEtine and Stop using Jewish owned CZcams as it funds Israel against your Allah
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!
Hi, is adobe allowing remote work?
Congrats ma boi
Congrats nigg*
what collection of questions you are talking about? Neetcode 150?
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?
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.
True, IMHO I think he should ask all the possible questions. To ease the doubt.
Been watching Mock interview sessions for a long time, but this is by far the most enjoyable session for my all time :)
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.
I just hate to ask questions for the sake of asking questions though...
@@MichaelButlerC frfrfr
This is the first time I watched a 40 minute video. Real fun, we want more of these!
The collab we waiting for..🔥
The only 2 coding channels i subscribed and getting that collab is awesome..
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
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 😃
well did you get the job?
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
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.
Invigorating! Great questions all around, even greater thoughts and solutions!
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.
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.
Priceless video!! Thank you so much!!
The collab I was waiting for years. You guys are prob my fav swe youtubers
Enjoyed this video so much i watched on both your channels. Can you make a series of this?
This interview made me realize that I can do it too. Thanks, Neetcode
So useful and so fun session. thank you for this video, it relaxes me somehow while hearing the layoff news
this was really informative and fun at the same time. thanks NeetCode.
Awesome, more of that would be highly appreciated
Nice video, I can feel the pressure of the interviewee by his word and face
Love this Mr. Neet Code!
Big fan of neetcode ❤️ just want to thank for all the amazing content you post in your channel... Thank you 🙏 love from India
the last part you ask 'do you talk like this in real interview?' and then 'nothing' really make me laugh
amazing content guys, loved it!
This was like actually really awesome. I felt like I was solving the problem with him!
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
excellent observation
what if you want to remove the number first in the list, you can't use pop() instead?
It's remove by value, so it's worst-case linear time for an array.
@@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.
@@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)
Love the "Now let me ask you another question" at the beginning haha. Very inciteful video btw
This is prolly the best channel out there for ds algos!!!
I love this, frying pan makes coding interviews fun
Neet code Please do conduct whenever possible it helps the everyone a lot of Learning. Thank you so much...
Nice video. Love to see more so I can prepare.
The collab I didn't know I needed ..... 🙃
Can we get more interviews like this one? It was really helpful. Thanks!! 🙂
??
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!
How did it go?
I never thought i needed this collab until now...
You never know what u need until its too late. Thats why ur broke.
pretty decent easy-med level q to ask, will use in my own new hire interviews as it makes for good discussion!
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.
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.
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.
Love this new content.
Bro why didn't you upload this sooner I had my interview yesterday :,)
Neetcode’s code is neat! Thank you Neetcode!
OMG, very impressed by this solution.
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.
FUC.K
This was fun. Never seen someone so pleased to get the answer :P
Unironically got a very similar question for Amazon SDE position
Funniest, energetic interview I have ever seen , I want confidence like this😅🤣
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.
There is no indexing in sets so self.map[value][-1] wouldt work and then he also pasted some wrong java code in
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.
hey hey dude, thanks for the vidos!! now a cool mood for the whole day :)))
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.
Are ya still down? :)
Well shown who is a front-end developer, thanks
This guy is total tech lead material
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.
More of these please !!!!!
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 🤞
Im not sure if the rudeness was real or satirical. I’m not sure if being rude to the interviewer is a great strategy.
Language barrier maybe? But prob satire
Great collab!
Do more of these
very useful and well designed website NC!
I am happy to know I almost guessed all the approach correctly!!
The snarky comments while Neetcode remained mute was hilarious
i was able to come up with similar solution. I'm happy lol. I was thinking along with him
Glad I could follow along with the code on the white Goggle Doc.
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?
I feel that moment when you said "do you really talk like this in real interviews" and he replied "what's wrong with how I talk"
Your reaction was "nothing" 🤣🤣 I felt that man 🤣🤣
He should have been honest there!
Judging from the comments he's kinda acting; but besides your ability to solve problems, it's also super important to be pleasant to work with. One can be funny and entertaining while staying humble and mindful.
like we say in chile, "que cagon eres" she should tell him with no fear of hurting him lol
This is brilliant
Bro please make more these kind of coding interview videos
OMG my two favorite youtubers!!!
I'm actually him during my interviews 😂😂 Its easy to figure out solution when you're not under pressure, but in actual interviews there's so many things that can happen and the anxiety can get to you and affect your performance.
I thought we were about to get a face reveal 😂
Maybe on part 2... lol
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.😊😊😝
@@NeetCode Is Techlead in the thumbnail
Me too..neetcode, make it happen!
Neetcode looks like an angel for sure
More please!
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.
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
@@mannyb096 removedInt
None of my coding interviews for internships have been anywhere near this easy
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
Thanks you @NeetCode.
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 😉
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?
@@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.
@@ashiqhussainkumar1391 I am sorry about that man. I hope you get your call soon
42:27 i'm dead 🤣 Neetcode, thanks for the video, i want to be smart like you
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
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!
Ngl I thought he'd do a lot better for a meta intern. The first question was easy as balls
Loved the vibe!
Lol, you just gotta love stack overflow
man plz do more and more hard and prefessional plz plz we need this.
Friendship is real lol Love it!
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
I think the end solution doesn't consider removing a value from a map that has only one index
"i have ocd and this is pissing me off"
My interviewer: get tf out then 😊
39:37 “bet you didn’t know that!”
LMAO 😂
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
I'll be honest I was expecting a harder question. Thank you for boosting my confidence 🤣.
But then again he is a fresh graduate/intern so I shouldn't compare myself...
Can you explain the follow up with allowing duplicates. I didn't understand that
Do interviews actually go like that? i started solving in javascript following a long and was happy i did good
how did I get this recommended just before the daily leetcode question became this today