Google Coding Interview With A Facebook Software Engineer

  Рет қаралды 918,248

Clément Mihailescu

Clément Mihailescu

3 жыл бұрын

In this video, I conduct a mock Google coding interview with a Facebook Software Engineer, SecondThread, who's also a competitive programmer. As a Google Software Engineer, I interviewed dozens of candidates. This is exactly the type of coding interview that you would get at Google, Facebook, or any other big tech company.
Check out @SecondThread's channel for cool competitive programming content: / @secondthread
AlgoExpert: www.algoexpert.io/clem
SystemsExpert: www.systemsexpert.io/clem
My LinkedIn: / clementmihailescu
My Instagram: / clement_mihailescu
My Twitter: / clemmihai
Prepping for coding interviews or systems design interviews? Practice with hundreds of video explanations of popular interview questions and a full-fledged coding workspace on AlgoExpert - www.algoexpert.io - and use the promo code "clem" for a discount on the platform!

Пікірлер: 1 200
@clem
@clem 3 жыл бұрын
So?! Is David an absolute savage at algo problems or what?! Be sure to check out the Q&A interview I did with him here: kzbin.info/www/bejne/b5zMYmCumpuLsLc - as well as David’s KZbin channel if you’re into competitive programming: kzbin.info/door/XbCohpE9IoVQUD2Ifg1d1g
@SecondThread
@SecondThread 3 жыл бұрын
Thanks for the interesting and fun problem! I really enjoyed the opportunity to work on it!
@abhiramianbu5137
@abhiramianbu5137 3 жыл бұрын
If somebody does not know this Aho-corasick algorithm, then the time complexity will be O(phoneNumberLength^2) with trie? Is there any better way to do it?
@same0533
@same0533 3 жыл бұрын
why is the facebook software engineer wearing google's tee??
@OG_Scratch
@OG_Scratch 3 жыл бұрын
@@same0533 That was google code jam competition tees
@same0533
@same0533 3 жыл бұрын
@@OG_Scratch oh
@sumitroy2006
@sumitroy2006 3 жыл бұрын
23 years of software development experience. I just feel the industry is getting to such a stage that you need 2 skill sets - One skill set for doing the job and one skill set to pass interviews!
@jimmyadaro
@jimmyadaro 3 жыл бұрын
Absolutely yes
@MaitraRoy
@MaitraRoy 3 жыл бұрын
@@jimmyadaro I just feel if it was a more mature industry, these interview processes would be more streamlined. Doctors and lawyers do not go through loops as they have a standard professional accredition. But in this industry as it is so new, you have to prove yourself over and over again. Past experience does not seem to count even if legitimate. The problem is unlike other professions, there is no real way to verify the experience.
@omerahmaad
@omerahmaad 3 жыл бұрын
Sumit you are a wise man and great comment I agree 1000% but add another thing landing on interview
@HangNguyen-wu3fs
@HangNguyen-wu3fs 3 жыл бұрын
before leetcode type of questions, there were whiteboard questions. I'd rather do LC type of questions than whiteboard questions.
@abhi-shekb
@abhi-shekb 2 жыл бұрын
that's true. An argument in favor of these interviews that I've heard is that big tech companies want to hire candidates who are so strong willed about joining the company that they will put in all the effort required for clearing these interviews.
@software_development
@software_development 3 жыл бұрын
dude be bussin out random algorithms that even the interviewer doesn’t know out here like “lemme use the ahoshinjinjutsu”
@vedantgarode
@vedantgarode 2 жыл бұрын
😂😂🤣🤣
@johnyepthomi892
@johnyepthomi892 2 жыл бұрын
😅 Panic mode ....
@Itachi_Uchia1
@Itachi_Uchia1 2 жыл бұрын
😂😂😂😂
@johnnm3207
@johnnm3207 2 жыл бұрын
ahhhhhhhhhhhhhhhh
@soruzein2988
@soruzein2988 2 жыл бұрын
😂😂😂💀
@snozzd
@snozzd 3 жыл бұрын
These are cool but it'd really help my ego if you hosted a mock coding interview with a candidate struggling to remember how binary search works.
@Dreadheadezz
@Dreadheadezz 3 жыл бұрын
Nah deadass bro I'm right with you 😂😂😂😂😂😂😂😂😂
@sanchit537
@sanchit537 3 жыл бұрын
Hahahahaha
@Rugg-qk4pl
@Rugg-qk4pl 3 жыл бұрын
Actually tho seeing someone struggle a lot with an interview would be interesting but I don't think the brutal internet would be very nice about it
@mastaharashibu7092
@mastaharashibu7092 3 жыл бұрын
YES that's a great idea
@siliev333
@siliev333 3 жыл бұрын
Better yet a candidate that doesn't know what binary search is.
@KennyTalksCode
@KennyTalksCode 3 жыл бұрын
12:45 honestly most impressed with him drawing out the trie in google docs, that's a skill in itself.
@kose241
@kose241 3 жыл бұрын
The speed was insane 😂
@mirsella6204
@mirsella6204 3 жыл бұрын
space bar go brrrrrr
@varmamahesh9725
@varmamahesh9725 3 жыл бұрын
@@mirsella6204 I think it goes like "tuk tuk tuktuktuk tuk"
@somiltyagi7127
@somiltyagi7127 3 жыл бұрын
we can scare our interviewer by saying different algo names
@lolerskates876
@lolerskates876 3 жыл бұрын
The Corbomite Maneuver Algorithm gives O( log(log(n)) time. Runs quick for even international phone numbers
@paraggupta2638
@paraggupta2638 3 жыл бұрын
@@lolerskates876 ok lets go with that
@RoshanPradhan2
@RoshanPradhan2 3 жыл бұрын
@@lolerskates876Can you give me a link to that algo??
@dev-skills
@dev-skills 3 жыл бұрын
I found throwing out these jargons and technicals terms on interviewers face very effective in impressing the interviewer.
@TechnicalAnkesh
@TechnicalAnkesh 3 жыл бұрын
yeah!! LOL
@mariyadimitrova2097
@mariyadimitrova2097 3 жыл бұрын
Normal people: watching horror films and yelling at the characters to get out Competitive programmers: watching coding interviews and yelling data structures at the interviewees
@SoraFromIndia
@SoraFromIndia 3 жыл бұрын
Lol I love this comment the most 🤣🤣
@themptytree3145
@themptytree3145 3 жыл бұрын
trie
@alankruthsai
@alankruthsai Жыл бұрын
🤣
@jerodewert8334
@jerodewert8334 Ай бұрын
I spend so much time going: why not a hash table?!
@tiberiusvetus9113
@tiberiusvetus9113 3 жыл бұрын
Programming interview tip: disable spell check, auto correct, turn on mono space font
@renjithroy8422
@renjithroy8422 3 жыл бұрын
Just learned to declare a variable in Javascript today and then I watched this video! 🥺
@KETANRAMTEKE
@KETANRAMTEKE 3 жыл бұрын
You are on a right path young Jedi.
@vpannava
@vpannava 3 жыл бұрын
I know how you feel.
@meliodas4560
@meliodas4560 3 жыл бұрын
Don't worry, there's actually nothing particularly complex in this video. There are two primary things that you will learn with experience (assuming you pursue an education in CS or software engineering): 1. Algorithms (and data structures), how they work, and their runtime efficiency (you'll understand deeply how nodes/trees are useful, how to code your own, and how/when to use existing libraries). 2. How to think about problems and the structures of code you need to solve them (like building multidimensional arrays or built-in list structures, how to iterate through them, etc.). Once you are familiar with a language, like Java, and using different data structures, plus coding your own data structures from scratch, and learning about different ways to get lower runtime, this stuff will flow from your fingertips. Like was mentioned in the video, this is pretty much all covered at the college level in data structures / algorithms courses, which is typically around year 2. Cheers
@ancarwillis9060
@ancarwillis9060 3 жыл бұрын
It’s a never ending process, and you got to really enjoy what you do. Formal education helps though. I completed my BS in Computer Science about a year ago and I’m sure if I had done this interview I would have just bombed it though. I took an algorithms class but frankly all I can recall from it is how to create iterative and recursive algorithms. Never even heard of Aho Corasick. Then again I work in Cyber Security and only really code for fun so my focus hasn’t been on that. Just keep at it I say.
@adilimanaliev3008
@adilimanaliev3008 3 жыл бұрын
i swear😢
@JacobHuber
@JacobHuber 2 жыл бұрын
I think whats good to note is not the algorithm he used specifically but the part where he took the time to consider and evaluate different solutions before implementation.
@Revelatus
@Revelatus 3 жыл бұрын
Wow I learned so much, including that I'm never gonna get a job as a programmer :D
@johnnycashcow1130
@johnnycashcow1130 3 жыл бұрын
Most jobs are not this technical and algorithmic/data structure heavy. Your typical programming interview will probably not even do one of these challenges. Software engineers who have have been in development for many years probably cannot do this without a bit of training. This does not mean that the software engineer is not as good as the competitive programmer. In fact, being able to do these types of competitive programming questions does not even guarantee you to be a good developer. What's most important is your ability to understand and read code. Also, you need to understand what is being used in the industry and be familiar with frameworks. To land a job, what matters is that you understand the concepts and in the interview, what matters more than actually solving the problem, is HOW you solve the problem Break the problem down into little pieces and build upon it and don't forget to be inquisitive. Be disciplined in your studies and I am sure you'll be able to land a job
@tnikoli40
@tnikoli40 3 жыл бұрын
@@johnnycashcow1130 this is my fear. Next friday i have an interview for a programmer/tester position where i will get 1 python and 1 c++ question. C++ is good cause i did lots of embedded while in college, but havent touched python in years. I know it will be sthing simple like make a function that does sthing easy but am afraid that i am gonna get sthing like this
@xrealy5700
@xrealy5700 3 жыл бұрын
@@tnikoli40 how it went bro
@arphaksad01
@arphaksad01 3 жыл бұрын
Depends on the industry
@DeepThinker193
@DeepThinker193 2 жыл бұрын
@@tnikoli40 Bet they asked something like jane has apple in her basket and john has oranges in his. Calculate the distance of the sun to the moon and code how to use a rocket to get there.
@xbmcme9768
@xbmcme9768 2 жыл бұрын
For all those that watched this and feel stupid, remember David has spent 6 years coding and mentioned he used to do 40hrs a week with CP for his college years. So don't feel stupid, but do cry at the fact that it might take years to get this good.
@azz111full
@azz111full 2 жыл бұрын
I've been a developer for about 8 years and this video blew my mind 😂 there are levels to this shit
@alekseikharchenko7246
@alekseikharchenko7246 2 жыл бұрын
@@azz111full definitely agree I have 6 years of commercial experience and feel the question itself is quite ok, but the speed David types the code is absolutely insane and so it is really hard to follow.
@disakek5438
@disakek5438 2 жыл бұрын
thats why it's way more chilling to watch this when you haven't even started university (Yay I don't have to know all of this already xD)
@kyopa9361
@kyopa9361 Жыл бұрын
what is CP?
@TK-fo5xl
@TK-fo5xl Жыл бұрын
competitive programming
@kaushaldawra3527
@kaushaldawra3527 2 жыл бұрын
that's not just a facebook engineer, that is a competitive coder
@jacked_asian
@jacked_asian 3 жыл бұрын
I always like Clement’s devious smirk when he hears that they’re close
@user-hl5fw1nw9l
@user-hl5fw1nw9l 3 жыл бұрын
Ive GOT to see this q&a video bc i am amazed how easily he walked thru all of this.
@weirdinternet6020
@weirdinternet6020 3 жыл бұрын
24:03 that's me in every coding interview
@dq303
@dq303 3 жыл бұрын
😂😂😂
@aj9706
@aj9706 2 жыл бұрын
I am jobless
@Solaris428
@Solaris428 2 жыл бұрын
Nice one.
@sagivtamir3102
@sagivtamir3102 2 жыл бұрын
The easier solution is: 1. Reformat the strings to numbers. 2. Create suffix tree for the main number. 3. Check for each number if it is in the suffix tree. That will take O(numOfStrings*LengthOfNumber) time. O(numOfStrings + LengthOfNumber) space. This would be much easier..
@YASHGUPTA-cg9fh
@YASHGUPTA-cg9fh 10 ай бұрын
Yes that's way easier its some sought of rabin Karp
@sauravsuri2188
@sauravsuri2188 Ай бұрын
This problem looks similar to word break problem. Is this correct?
@viku453
@viku453 2 жыл бұрын
I really wish in a real interview the interviewer would have allowed me to leave the hard portion of the implementation of the algorithm blank and to proceed with the rest of the bits and pieces of the program with the method signature intact 😂. You are awesome Clement! This would have made my life so much easier 😊.
@Grr1967
@Grr1967 3 жыл бұрын
Wondering if he refers to neighboring node in a graph as "bro" :-)
@clem
@clem 3 жыл бұрын
🤣
@123aniruddhsiddh
@123aniruddhsiddh 3 жыл бұрын
Kids and bros :D
@divvagg5616
@divvagg5616 3 жыл бұрын
@@clem hello sir , can you please provide or suggest any source to learn data structures and algorithms from absolute beginner to master level .
@souravsaha1443
@souravsaha1443 3 жыл бұрын
Second thread is my idol.. I follow him a lot for competitive programming
@andrewyemtsev4993
@andrewyemtsev4993 3 жыл бұрын
I think that would be a good idea to giveaway an interview with ex-Googler, but with a medium level question. Would be a dope content. Since I cannot even comprehend what this mastermind is saying
@alexIVMKD
@alexIVMKD 3 жыл бұрын
Amazing... Really liked this one. Also, liked seeing some java.
@abhaypatil2000
@abhaypatil2000 3 жыл бұрын
I have been watching his videos since a long time. I never knew he was in facebook. Congrats secondthread🤗🤗🤗🤗🤗🤗
@aj9706
@aj9706 2 жыл бұрын
He is grandmaster. So it is meta
@codeandcurious
@codeandcurious 3 жыл бұрын
Thank you Clement the video helped in giving an overview of how to communicate our ideas during an interview
@seanlau8069
@seanlau8069 3 жыл бұрын
Now I want to see clem being interviewed XD
@zhenniu2451
@zhenniu2451 2 жыл бұрын
@clement, I love how you ask questions that's simple enough to solve within the timeframe but will get great signals out of the candidate. This will be testing people on their problem solving skills instead of how well they can prep for an exam.
@zhenniu2451
@zhenniu2451 2 жыл бұрын
Second thought is that it's pretty cringe following through his interview since my thought process is very much top down compare to David's bottom up. So it's very interesting to see how we have such polarize types of engineers.
@elirannissani914
@elirannissani914 3 жыл бұрын
You have to do a coding interview with the cherno he is SUPER SMART!!
@eliasmoreno4672
@eliasmoreno4672 3 жыл бұрын
thes videos are really helpful for interview preps. thank so much!!! pls make more
@vikramc.n.1121
@vikramc.n.1121 3 жыл бұрын
Looking smart in this hair style sir. Also thank you for being such an inspiration person and thank you for helping us with your awesome videos
@SyedAhmed-lv3kh
@SyedAhmed-lv3kh 3 жыл бұрын
u guys had me at the part where u were explaining how the words correspond to the numbers :D
@gianclaudiomoresi9650
@gianclaudiomoresi9650 3 жыл бұрын
Basically is a normal exercise. The lenght of the phone number is in the praxis fix, so that is possible to simplify the solution. You just convert the words in number, and you build all possible permutations with these numbers. If the combination have a match with the given nbr., you find then word combination.
@ayushsrivastava485
@ayushsrivastava485 14 күн бұрын
#include using namespace std; // Ques: from a numpad given a number and a vector of string of words, find all the possible words that can be formed from the number vector solve(string number, vector &words, unordered_map &numpad) { vector res; for (auto it : words) { string temp = ""; for (int i = 0; i < it.length(); i++) { temp.append(numpad[it[i]]); } if (number.find(temp) != string ::npos) { res.push_back(it); } } return res; } int main() { unordered_map numpad; numpad['b'] = '2'; numpad['a'] = '2'; numpad['c'] = '2'; numpad['d'] = '3'; numpad['e'] = '3'; numpad['f'] = '3'; numpad['g'] = '4'; numpad['h'] = '4'; numpad['i'] = '4'; numpad['j'] = '5'; numpad['k'] = '5'; numpad['l'] = '5'; numpad['m'] = '6'; numpad['n'] = '6'; numpad['o'] = '6'; numpad['p'] = '7'; numpad['q'] = '7'; numpad['r'] = '7'; numpad['s'] = '7'; numpad['t'] = '8'; numpad['u'] = '8'; numpad['v'] = '8'; numpad['w'] = '9'; numpad['x'] = '9'; numpad['y'] = '9'; numpad['z'] = '9'; string number = "3662277"; vector words = {"foo", "bar", "baz", "foobar", "emo", "cap", "car", "cat"}; vector res = solve(number, words, numpad); for (auto it : res) { cout
@adabaladurgaprasad7926
@adabaladurgaprasad7926 3 жыл бұрын
I regularly watch second threads KZbin channel, but didn't know he was a facebook software engineer till now🔥
@chinmaym7479
@chinmaym7479 3 жыл бұрын
Same bruh
@prateeksinghal630
@prateeksinghal630 3 жыл бұрын
You should have checked his Facebook profile : p
@ironyman7015
@ironyman7015 3 жыл бұрын
i though he was a student.
@alicebobson2868
@alicebobson2868 3 жыл бұрын
@@ironyman7015 😂
@piyushpatel2347
@piyushpatel2347 3 жыл бұрын
I regularly watch SecondThread videos and I knew since long back that he recently started working for FACEBOOK APP and was also a tester for Facebook hackercup
@TechnicalAnkesh
@TechnicalAnkesh 3 жыл бұрын
David is a Great programmer!! he explains everything very nicely
@David-uc3cl
@David-uc3cl Жыл бұрын
Thanks, wish everyone else would realize this
@qutaibaal-nuaimy1697
@qutaibaal-nuaimy1697 3 жыл бұрын
I could be wrong, but after attempting this problem it's clear that you can also solve it (pretty quickly) by converting all of the input words into numbers (using a hashmap) and then checking if those numbers are contained in the phoneNumber input with a simple if "322" in "322245" check (for example). This gives you a space complexity of O(N = Lenght of Array) and time complexity of O(N*M) where M = Length of Word. I like the uploaded solution in this video a lot, but for many new grads and underclassmen looking for jobs who feel intimidated by this, then just know there's an equally valid and much simpler solution to this problem!
@iqramunjoreen4312
@iqramunjoreen4312 2 жыл бұрын
Thank you for this comment. Really. I was sweating and crying at this video
@tonaxysam
@tonaxysam 2 жыл бұрын
I thought the same thing! I guess the "in" check is a bit slow because for it to check if first is on second, it has to go through all the second string untill it finds the coincidence (if there's one). And the method he proposed is usefull in the sense that it uses information gained with previous checks. For example, we have "foo" and "foots" and we want to know if either of those are on "footage", if you do the "in" check for Both, the "foo" will be very fast while the "foots" one will take (the length of the word we're searching in) minus (the length of the word "foots"), with the method he proposed, after knowing that the coincidence "foo" appears on the word, we just gotta continue from there to find out that "foot" is in the word but then the coincidence breaks. So we just took two steps by using information gained with previous comparations. Is like the "foreach word: If word in theThing" but where you're allowed to use information you gain with each new word, so that makes it a bit faster (and for large enough arrays, way more faster)
@obsidian8037
@obsidian8037 2 жыл бұрын
yes.
@dionisorules
@dionisorules 2 жыл бұрын
@@obsidian8037 but he had to build that aho thing which who knows what complexity its has (both time space) to populate all words. He never mentioned that.
@MegaJiggaa
@MegaJiggaa 2 жыл бұрын
@@dionisorules it runs in linear time, just bfs
@ryangulati5872
@ryangulati5872 3 жыл бұрын
Hey Clement, do you have a front end expert in the works? I would totally buy that!
@mexicanmax227
@mexicanmax227 2 жыл бұрын
I can see the Facebook engineers adrenaline rush as he solves it, passion!! Reminds me of when clement is presenting in a video, passion!! Social cues like these are always so awesome to notice, Passion!! lol
@alexisrodriguez7127
@alexisrodriguez7127 2 жыл бұрын
Passion!!
@sar6575
@sar6575 3 жыл бұрын
David is an absolute god not only with his quick solutions but his coherent ability to explain things very simply is awesome !!!
@warpromo6636
@warpromo6636 3 жыл бұрын
i assume ur experienced. why doesn't he just do let number = "3662277"; let phonePad = ["", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"] let words = ["foo", "bar", "baz", "foobar", "emo", "cap", "car", "cat"]; let works = []; for(var a=0; a
@karankumar89
@karankumar89 3 жыл бұрын
@@warpromo6636 because 90% of Google, Facebook, Amazon interviewers are super anal about you giving an optimized solution using tree structures in 30 minutes that excuses without errors. ( they themselves wouldn't be able to do it, the irony). Which is why these interview methods are broken and outdated
@cybermanga2916
@cybermanga2916 2 жыл бұрын
That Guy is a Mathematician!
@jaysizmir9432
@jaysizmir9432 3 жыл бұрын
his explanations was super clear, amazing !
@TheProductofyourmind
@TheProductofyourmind 2 жыл бұрын
I don't know anything about coding (but planning to learn about it), so thinking about this problem and then following along with how the candidate approaches it was super interesting to me.
@XnazxulX
@XnazxulX 3 жыл бұрын
This is such a good question. I wish i was smart enough to be able to look at something and come up with n number of algos off the top of my head that would be a candidate for it. Love your interviews.
@MrRushifyIt
@MrRushifyIt 3 жыл бұрын
you can be that smart! You just have to surround yourself this sort of content and build up a knowledge base. look at his github repo at 47:49. When he hears about an algorithm, he does some research on it, then tries to implement it himself, then saves it in his collection. Always be curious and willing to try new things, you'd be amazed at what you can accomplish.
@NickRusev
@NickRusev 2 жыл бұрын
I just studied for loops and came across this video. My self-esteem dropped to the ground. 😅
@CaptainSchlockler
@CaptainSchlockler 3 жыл бұрын
Most convoluted approach to solving a problem I have ever seen. XD
@fyiwdt
@fyiwdt 3 жыл бұрын
That was fun. But in real interview this can be a really dangerous strategy, because interviewer must be ready for such turn of events. And Clément pointed that out, thanks.
@xs-3
@xs-3 3 жыл бұрын
I don't know why but i like the way this guy talks and explains things
@quachiecan6644
@quachiecan6644 3 жыл бұрын
Could you do one with a “typical” college student in college? Usually these people you interview are 1%er’s if that makes sense and it makes me as a computer scientist on my second year of college super intimidated and inferior.
@rousseau327
@rousseau327 3 жыл бұрын
But, to put it bluntly, that does nothing but make you feel better about your current situation in your career. Seeing a very competent Software Engineer tackle these problems helps you get a better understanding of how you should approach these interview problems.
@1andrew123
@1andrew123 3 жыл бұрын
Dont compare yourself to these guys expecting to be this good.. do it to give yourself something to strive for. Accept where you are and keep taking baby steps and before you know it youll be here
@Jindujun
@Jindujun 3 жыл бұрын
Just admire what people are able to do and strive to get better, thats all you need to do. Go your own path and don't chase after those guys.
@quachiecan6644
@quachiecan6644 3 жыл бұрын
I feel like I might’ve not gotten my point across. I want to have a “typical” college student/person do it so I know how exactly they would go about the interview because I haven’t seen how THEY would go about the problems. Because everyone that has taken these mock interviews already know how to do it (for the most part) and breeze through it like nothing. The closest person we’ve seen to a “typical” interview was Tech with Tim’s.
@darksavior1187
@darksavior1187 3 жыл бұрын
@@rousseau327 Sure, however, anyone soon to graduate and seek a new position are among the most likely demographic looking at these videos.
@siouxperirish
@siouxperirish 2 жыл бұрын
I enjoy the format of these interviews and I’m curious if you as the interviewer, would be open to redefining the approach to attacking this toward a solution. If you or others would generally be open to allowing the interviewee basically change the use case to begin with the end defining the beginning. If your eyes haven’t glazed over yet, what I mean in this situation is to try and convince the interviewer up front; agree on an assumption which would reduce complexity. I realize you’re looking for construction ability, complexity, quality, efficiency, but if you could agree ahead of time on a logic-based route to completion, before coding begins, then I would say I would provide the customer all the available phone number combinations they could choose from, as the output and ask them to enter their word since they’ve probably settled on a company name and just need to find a number that can represent the name. Not targeting this instance in particular but I guess I am. Overall, would this taint the interview or would this generally be thought of positively, a perspective employee pushing back a bit right up front. I know for me, I try to dumb the complexity down (for lack of a better phrase), so I can begin with what feels like my idea or my internal translation of the ask. Thanks and sorry if I’ve bored everyone with my question.
@andrewpeterson5882
@andrewpeterson5882 2 жыл бұрын
Would love to hear Clement's answer to this question as this very situation happens... essentially with every project in software design and consulting.
@potter2806
@potter2806 3 жыл бұрын
Thanks a lot for this coding interview, Learned a lot from this!
@kevinleesmith
@kevinleesmith 3 жыл бұрын
Did you learn how NOT to solve problems? I solved it in 30 seconds with something far simpler.... (or am i missing something - happy to be proved wrong) For each word in words If instr(word2number(word), phoneNumber) > 0 then output word VBscript implemetation... 0 then response.write word & ", " next %> Essentially 2 lines of code and 2 loops. See it working at https:/pragmatic365.org/google-interview.asp The whole idea of software engineering is to write as LESS lines of code as possible, not the most!!! But what do I know. I've only been coding for 42 years.
@JerryO1995
@JerryO1995 3 жыл бұрын
​@@kevinleesmith well the thing is that they always look for the most efficient solution possible so, unless you're a genius, 30 seconds is not enough for that. Also, they want to see and hear you go through every piece of information that your brain processes, and I'd argue that that's the most important part of the interview for the interviewer. Moreover, your code uses "Instr", which is a builtin function with a complexity that, if you don't take it into consideration, might make your code way less efficient than it could be with a more complicated algorithm such as the one explained in the video. The fact that you've been coding for 42 years (deep respect for that) doesn't mean that you'd do well in a FAANG interview. However, I do believe that these interviews are stupid for 99% of the applicants since most of them are never going to have to think about and code such difficult algorithms for this sort of strange situations.
@blueprintmentors3762
@blueprintmentors3762 3 жыл бұрын
Here's another GREAT vid on how to get into Google: kzbin.info/www/bejne/rKKlkGybiMaZosk
@the0dd1out_on_yt
@the0dd1out_on_yt 2 жыл бұрын
Instead of doing complex Aho-Corasik, we can do a lil tricky hashing stuff here. Suppose N= all the characters in input. We will map all the substrings we find from given number of length less or equal to √N to find matching in the strings size less than equal √N and for bigger strings we can manually hash match each with the given number string! Complexity: N√N*(some log factor for mapping)
@chloeagape4853
@chloeagape4853 3 жыл бұрын
cool! I actually came up with like 75% of the solution before seeing what he did. I was stuck at figuring out how to backtrack back once you've explored a path, and I guess there was a fancy algorithm (aho) that finds the fail links. In a real interview, I guess leaving out the aho algorithm would be ok as long as you were able to mention and talk about it.
@HokageKyubiNaruto
@HokageKyubiNaruto 2 жыл бұрын
Where do you work
@jmiller4559
@jmiller4559 2 жыл бұрын
Amazing job! Learned a lot! Thanks!
@MiketheCoder
@MiketheCoder 3 жыл бұрын
He's a facebook engineer? I thought he was a competitive programmer student.
@DanielNyong
@DanielNyong 3 жыл бұрын
New grad, dope channel btw I watch you both.
@aldinprayoga2266
@aldinprayoga2266 3 жыл бұрын
It's me
@NytronX
@NytronX 3 жыл бұрын
Pro tip: You can name drop Aho in an interview, but never call the interviewer Aho.
@pradeepganesh712
@pradeepganesh712 3 жыл бұрын
Ahh.... A man of culture I see XD
@kelvinxg6754
@kelvinxg6754 2 жыл бұрын
Lmaoo
@harispapadopoulos4295
@harispapadopoulos4295 3 жыл бұрын
oh man, the excitement I get every time I see the notification that clement uploaded a new video
@coryschallert8915
@coryschallert8915 2 жыл бұрын
This is awesome but terrifying at the same time. This "Mock Interview" will lead to much bigger "applications" in the real world.
@iconicae8814
@iconicae8814 2 жыл бұрын
thank you for these useful interviews
@rabinacharya8429
@rabinacharya8429 3 жыл бұрын
I dont understand any of the logic here. Yet I enjoy watching the full video.🤣
@mattconrad
@mattconrad 3 жыл бұрын
LOL @ Clem's reaction when SecondThread says "Aho-Corasick" for the first time 😂
@adithyaks8584
@adithyaks8584 3 жыл бұрын
I got this in an interview with FAANG (PS: I wrote a recursive solution and cracked it, we didn't venture into dp... If dp is required store an array of strings that has all possible strings starting with index i)
@roshan84ya99
@roshan84ya99 3 жыл бұрын
Waiting for this for so long and one more thing could you please also put those links(question link) so that we can also solve them .
@skdx1000
@skdx1000 3 жыл бұрын
this is perfect timing because i had to implement aho-corasick for work last week!!!!
@Garentei
@Garentei 3 жыл бұрын
What kind of work do you do? Lmao
@skdx1000
@skdx1000 3 жыл бұрын
@@Garentei i am an nlp engineer and implmenting/designing fast text search is part of daily work lol so this kind of stuff comes up very often. i deal with graphs and trees daily lol
@Garentei
@Garentei 3 жыл бұрын
@@skdx1000 Cool!
@JohnCodes
@JohnCodes 3 жыл бұрын
Might as well start rounding out FAANG with some netflix, airbnb, etc interviews!
@CharlesRay87
@CharlesRay87 3 жыл бұрын
Hi @Clem! What is an acceptable solution you mentioned, not requiring AHO algorithm?
@NuanDaa
@NuanDaa 2 жыл бұрын
It’s easy but very understandable explanation.
@risingdevelopment6635
@risingdevelopment6635 3 жыл бұрын
I started laughting so hard at 29:30 when David sai "kids" all those times haha (not kidding) Really good video, Clément, and really good interview David. I'll probably subscribe to AlgoExpert tbh, on each video you release my will increases haha
@aituganmirash2834
@aituganmirash2834 3 жыл бұрын
Petition for Clement to add this question on algoexpert
@axlrose010101
@axlrose010101 2 жыл бұрын
I'm learning Python and programming for 6 months now and i found the/a solution. Not sure that its nice or clean or "pythonic", and i still have a long road ahead. But I'm so happy and it's a great feeling ^^
@farazcsk
@farazcsk 2 жыл бұрын
Great video! Any tips for coding in Google docs? It looks like here David actually managed to get indentation working at least
@_zaverus
@_zaverus 2 жыл бұрын
For those who want a simple alternative solution I made using JavaScript, not as advanced as the solution in this video, not using any special algorithms (after I heard the question, I decided to attempt it first before continuing the video) but I believe easier to understand, I have added in reply of this comment so that I don't flood this comment section, copy paste into a js file and use node to run it! :) If anyone have any comments that can help me improve on my code, do reply! I'm here to learn as well Explanations of my code: 1. I used a lookup table (mapToNumber) because it's efficient and easy to understand, key value pair. 2. I used multiple functions to try to make the code as clean as possible 3. I made sure the functions in my code are pure functions (meaning return value is only determined by its input values) 4. I used split function to determine if word exists, basically, after the split function, the returned string will change if the number string exists in the phone number, by literally using the converted word to number as the delimiter. so, example if foo = '366', the program will find the string 366 in the phone number, and if it exists, it will modify the phone number, and a check will come in to determine if the string has changed.
@sandeepnath9504
@sandeepnath9504 3 жыл бұрын
That was pretty complex😵. If I were asked this question by an interviewer in some companies interview I would have said like the best possible solution to this problem is not trying for this company at all...!!!😂
@chernanq88
@chernanq88 2 жыл бұрын
hahaha yeah... and for a simple phone number
@Solaris428
@Solaris428 2 жыл бұрын
He overcomplicates it though IMO, maybe because he wanted optimal complexity idk .
@therealg4197
@therealg4197 Жыл бұрын
its not hard. You can solve it with a hash map . Its getting a super optimal sol that's hard
@md2perpe
@md2perpe Жыл бұрын
Going directly for a complicated algorithm is seldom recommended. Usually data is small and a simple and straightforward solution works fine. In this case, the phone number can be expected to be relatively short, not more than 20 digits. The words will also be short. But the number of words might be large. Therefore, it's probably okay if the algorithm is O(N²) in the length of the phone number, but it should be O(N) in the number of words.
@fabriziodutto7508
@fabriziodutto7508 3 жыл бұрын
Well, translating the words into string of digits, loop for every digits string, if the digit string is contained in telephone number as a string of digits (first occurrence) return word is contained otherwise word is not contained... there are many methods to compare two strings, and we're not going to re-engineering the wheel... To further optimize, you can momoize the function that check if the "numerical" string is inside the telephone number.
@radulaski
@radulaski 3 жыл бұрын
Just using RegExp for this type of interview would be out of a question?
@slayemin
@slayemin 3 жыл бұрын
Damn dude, just go with the O(n^2) implementation and hard code the character to number conversion. There's no reason to worry about O(n^2) runtime when n is so small. If your code is simpler and takes less time to write, and isn't performance critical, it's more maintainable and easier to understand.
@olokix
@olokix 3 жыл бұрын
I was thinking about pre-calculating numbers ahead like every common word(s) (there is like 300k words in english), storing them with certain hash/bite-encode (idk how to explain aka shortcut) and then only regular binary search or something as B+ tree, so it would take time in pre-calculating phase but after it it has O(log2) space requirment is worse but it's price that you pay for fast search? I hope it makes sense a little :D
@Smoothie128
@Smoothie128 3 жыл бұрын
That is why you are not working at Google :D
@slayemin
@slayemin 3 жыл бұрын
@@Smoothie128 Hah, you're right :) I work at facebook instead.
@hattapalkan8395
@hattapalkan8395 3 жыл бұрын
@@slayemin dude stop you destroyed him
@farhanaditya2647
@farhanaditya2647 3 жыл бұрын
@@slayemin bruh, that's brutal 😂
@luisecmartinez
@luisecmartinez 2 жыл бұрын
I genuinely have no idea whats going on but I've watched a few and im intrigued
@adhpublications6436
@adhpublications6436 2 жыл бұрын
See How Facebook Login Page is Coded : kzbin.info/www/bejne/j5uUfXSuiJxpf7c
@yayin5929
@yayin5929 3 жыл бұрын
How impressive he knows such algorithms, How can he not forget that haha 😂
@Pctech4uproductions
@Pctech4uproductions 3 жыл бұрын
You said you'll put a link to aho korasick algo in the description :(
@luke0750
@luke0750 14 күн бұрын
I don't actually do that much algorithms and data structures but I looked at two videos Clement and I solved both of them in between 1-2 hours. Its not really hard for me even tho I have only 2 years of experience. I will admit that I make a lot of mistakes and I might not be that much articulate and explain things that I am doing in such clear way that those engineers do. When you first watch video you say these guys are super genius or that kind of but when you actually do them it really is easy. I hope I will keep up doing algorighms for a week I really enjoyed those problems.
@rgb5521
@rgb5521 3 жыл бұрын
Love this kind of videos 👍😊🥰
@satyampatidar5848
@satyampatidar5848 3 жыл бұрын
David (aka second thread) completed his bachelor's degree in 2020. And now he is full time Engineer i think
@SecondThread
@SecondThread 3 жыл бұрын
Indeed, I'm surprised you know!
@satyampatidar5848
@satyampatidar5848 3 жыл бұрын
@@SecondThread yeah.. from linkedin
@steve680
@steve680 3 жыл бұрын
You should try running the code to see if it actually works. This is one of the problems with these whiteboard exams. And you should have him comment his code too.
@Grr1967
@Grr1967 3 жыл бұрын
Great video. One thing I learned is that black t-shirts are mandatory for both interviewer and interviewee :-)
@quirkyquester
@quirkyquester 3 жыл бұрын
Amazing video! Thank you!!!
@nemotivity
@nemotivity 3 жыл бұрын
Google Coding Interview With A Facebook Software Engineer who is wearing a Google T-Shirt! 😅
@mangeshrananavare5656
@mangeshrananavare5656 3 жыл бұрын
Tbh this could have been done in such a simple way. I dont understand why ppl dont simply use arraylist/maps and existing built in datastructures, which already have utility methods that make our life so much easier.. None the less nice problem
@kira7741
@kira7741 2 жыл бұрын
I would have used an arraylist here however I'm not sure how to compute the space time complexity. So maybe they're after the lowest time complexity here.
@kaveenjayamanna3076
@kaveenjayamanna3076 Жыл бұрын
Please keep doing sessions like this
@dvldgz6306
@dvldgz6306 3 жыл бұрын
I'd love if you could get the youtuber code bullet to try one of your mock interviews. I just think it would be very entertaining
@Clashtoons
@Clashtoons 3 жыл бұрын
That was cool
@peepoHappyy
@peepoHappyy 3 жыл бұрын
WHAT ARE YOU DOING HERE LOL?
@Clashtoons
@Clashtoons 3 жыл бұрын
@@peepoHappyy if you have watched my videos, and looking my comments in this geeky thing. Then I can imagine why would you be amused. Can I ask. Is it that the case? That would be awesome😂
@peepoHappyy
@peepoHappyy 3 жыл бұрын
@@Clashtoons Man, I mean you make cartoons and such, why are you on a video about a coding interview?? 😂
@peepoHappyy
@peepoHappyy 3 жыл бұрын
Also, your cartoons are one of my pure nostalgia. Keep up the amazing work!
@Clashtoons
@Clashtoons 3 жыл бұрын
@@peepoHappyy I make cartoons as an hobby and do coding also as an hobby and a profession. Thank you. This is the first time me being "recognised in public" moment for me.
@EliaBonetto
@EliaBonetto 3 жыл бұрын
What about using /10 and % length of the converted word? Then you can subtract the two numbers if the result is zero you've found it. Would be O(n*#words).
@h82w8_1
@h82w8_1 2 жыл бұрын
Top solution! Much better than algorithm which was implemented in video!
@dev-skills
@dev-skills 3 жыл бұрын
Great to see you are sticking to primitive int arrays instead of Arraylist
@dev-skills
@dev-skills 3 жыл бұрын
Towards the end you used ArrayDeque which might upset interviwers who dont have java background.
@SANGKAYEBOY
@SANGKAYEBOY Жыл бұрын
i'm going shifting from technician to test dev eng'g works. very interesting to see dis tuts
@codefallacy
@codefallacy 3 жыл бұрын
when the interviewee brings out the big algorithms
@lb2113
@lb2113 3 жыл бұрын
Thanks for posting this problem. Very interesting. I would have never tried to apply some algorithm to this solution, however (maybe that's why I don't work for google or facebook, lol). I came up with a solution in C# using a Dictionary and 1 line of LINQ code. Simplicity almost always trumps complexity. My advice would be to use whatever libraries are available before resorting to some hand-coded algorithm for someone else to maintain - only resort to hand-coding when performance is an issue.
@shawnreichard2850
@shawnreichard2850 2 жыл бұрын
Yea I was thinking of just converting words to numbers and then doing string.contains on each.
@Flyed
@Flyed Жыл бұрын
Complexity can often trump complexity for high performance applications.
@Rx7man
@Rx7man 3 жыл бұрын
I'd do it this way... I'd hope that whatever language I'm using has some moderately optimised substring search function, for something in the reasonable lengths of a phone number (within an order of magnitude or so) it shouldn't make a big difference in speed for each testword in testwordlist if(phonenumber.contains(getnumericalstring(testword)) outputlist.add(testword) end if next return outputlist
@tahartouati9349
@tahartouati9349 3 жыл бұрын
I have had this problem on a coding challenge but on steroids (list of phone numbers and list of strings, and then return them in an ordered list) basically the hard part was to get it done with an acceptable runtime
@xSferQx
@xSferQx 3 жыл бұрын
So glad I'm working in small companies, don't deal with interviews like this and earn even better money
@Cmbhsd
@Cmbhsd 3 жыл бұрын
Would i be allowed in a coding interview to use a dictonary in python to map the letters to the numbers to be able to decript the words easier and simplyfy the problem? Because all of this seems more complicated to me then the actuall problem. Yet it was very fun to implement for me
@korvan
@korvan 2 жыл бұрын
Was thinking the exact same thing....and he mentioned it as his first possible solution then completely forgot about it for complexity (it seems)...haven't watched to full video to see why he went with that approach.
@Aks-47
@Aks-47 2 жыл бұрын
waiting for a HEALTHYUG google coding interview round!
@mba2ceo
@mba2ceo 2 жыл бұрын
YES WE DO !!! I want to see it compile !!! and WORK
What To Do If You're Stuck In A Coding Interview
9:48
Clément Mihailescu
Рет қаралды 170 М.
Google Frontend Interview With A Frontend Expert
47:59
Clément Mihailescu
Рет қаралды 1 МЛН
Эта Мама Испортила Гендер-Пати 😂
00:40
Глеб Рандалайнен
Рет қаралды 10 МЛН
ISSEI funny story😂😂😂Strange World | Magic Lips💋
00:36
ISSEI / いっせい
Рет қаралды 129 МЛН
How Much Money I've Made As A Software Engineer, Entrepreneur, And YouTuber
14:18
Google Coding Interview With A College Student
59:57
Clément Mihailescu
Рет қаралды 1,5 МЛН
Google Coding Interview With A High School Student
57:24
Clément Mihailescu
Рет қаралды 3,9 МЛН
Google Coding Interview With A Normal Software Engineer
59:56
Clément Mihailescu
Рет қаралды 1,6 МЛН
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
Рет қаралды 953 М.
How I Cracked the Google Coding Interview (from unemployment)
12:44
Medium Google Coding Interview With Ben Awad
51:27
Clément Mihailescu
Рет қаралды 1,2 МЛН
Beginner React.js Coding Interview (ft. Clément Mihailescu)
36:31
Ben Awad
Рет қаралды 2,1 МЛН
Google Interview Experience | Accepted... then Rejected
17:23
Keep On Coding
Рет қаралды 393 М.
Распаковка айфона в воде😱 #shorts
0:25
Mevaza
Рет қаралды 1,4 МЛН
Apple Event - May 7
38:32
Apple
Рет қаралды 6 МЛН
What % of charge do you have on phone?🔋
0:11
Diana Belitskay
Рет қаралды 339 М.
Any Sound & Call Recording Option Amazing Keypad Mobile 📱
0:48
Tech Official
Рет қаралды 325 М.
Android top🔥
0:12
ARGEN
Рет қаралды 1,5 МЛН
Он Отказался от БЕСПЛАТНОЙ видеокарты
0:40
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,9 МЛН
Обманет ли МЕНЯ компьютерный мастер?
20:48
Харчевников
Рет қаралды 111 М.