Python Interview with a FAANG engineer

Watch someone solve the alien dictionary problem in an interview with a FAANG engineer and see the feedback their interviewer left them. Explore this problem and others in our library of interview replays.

Interview Summary

Problem type

Alien Dictionary

Interview question

There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of words from the dictionary, where words are sorted lexicographically by the rules of this new language. Derive the order of letters in this language. For example, Given the following words in dictionary, [ "wrt", "wrf", "er", "ett", "rftt" ] The correct order is: "wertf".

Read more about the questions

Interview Feedback

Feedback about Mythic Goose (the interviewee)

Advance this person to the next round?
Thumbs up
How were their technical skills?
How was their problem solving ability?
What about their communication ability?
# test 1: normal case # words = ["wrt", "wrf", "er", "ett","rftt"] # output = getOrderOfAlienAlphabet(words) # print(output) # test 2: empty list does not crash # words = [] # output = getOrderOfAlienAlphabet(words) # print(output) # test 3: empty list does not crash words = ["wrt", "er", "ett","rftt"] output = getOrderOfAlienAlphabet(words) print(output) # Notes # + Writing down as much as pseudocode as possible around your approach # + Communication - verbalizing as you were coding # + Concluded that top sort is the way to go # + Graph structure to maintain relationships # + Proactive test cases # + Proactively talked about tinme complxity

Feedback about Elemental Armadillo (the interviewer)

Would you want to work with this person?
Thumbs up
How excited would you be to work with them?
How good were the questions?
How helpful was your interviewer in guiding you to the solution(s)?

Interview Transcript

Elemental Armadillo: So let's get into it a bit about me. I have been at Facebook for seven years. Currently I'm at a startup, but before this I've been at Facebook seven years. Overall, I have around 14 years of experience. Yeah, happy to learn a bit more about you, what you're looking for in this interview, if there are any interviews coming up, what kind of companies those are with and stuff, that'd be good to know.
Mythic Goose: Okay, great. So I've been in the industry for about 15 years, in my current position, for about three years now. I work as a senior team lead at Lassien, and I'm looking to transition to companies like Facebook and especially Google is my dream company. Yeah, that's basically what, you know, one of those kinds of interviews is what I'm hoping, what I would be able to eventually attempt once I'm done with everything.
Elemental Armadillo: Got it. Okay, so you want to try, like, a Google kind of interview?
Mythic Goose: Sure, yeah, if that's okay.
Elemental Armadillo: Yeah, let's dive into it. Give me a couple of minutes. Let me just find a right problem that makes sense.
Mythic Goose: Yeah, no worries. I'm just changing the language to Python Three.
Elemental Armadillo: Sure, yeah, find something that's still trying to find something good.
Mythic Goose: No worries. It doesn't have to be like a Google question. Like, Facebook also works fine.
Elemental Armadillo: Okay, I have a good Google question. I'm trying to find the definition from decode. Again. This is actually I was asked this when I interviewed at Google.
Mythic Goose: Gotcha.
Elemental Armadillo: Give me a couple of moments.
Mythic Goose: No worries.
Elemental Armadillo: Okay. All right, I think this is a good one. So I'm just going to post the question and this is kind of copy from decode, but again, this is a valid, like, Google question. I'll let you I'll give you some time to read through it and then we can dive into it.
Mythic Goose: Okay, so the question is, there's a new alien language which uses the Latin alphabet. However, the order among the letters are unknown to you. So ABCDE is not the order, it's some other order. You receive a list of words from the dictionary where words are sorted. lexicographically, by the rules of this new language, derive the order of the letters in this language. Order of the letters in this okay, got you. And lexicographically means like in the new dictionary. I mean lexicographically by the rules of the new language. Okay, got you. Okay.
Elemental Armadillo: So if you just look at this word WRT, the fact that there's a word means that W comes before R and R comes before T in the alien language.
Mythic Goose: W comes before T-R-W comes before R and R comes before t. Okay, I see. So I was trying to work my way through this example. So T and F, this means that T comes before F, w comes before E, w comes before R. Okay, got you. I see what you were saying. Okay, cool. So let me see if I could maybe think of some brute force approaches to this. So the idea is we need to find out which word comes before what, and the way to do that might be to compare adjacent words before that. Let me just get a few questions out of the way. Can there be duplicates in this list? Can there be duplicate words?
Elemental Armadillo: No, let's assume that there are no duplicate words. Again, the list is sorted, so if there are duplicates, you can eliminate them easily. But let's assume there are no duplicate words.
Mythic Goose: Okay. No dupes. And the second thing that I wanted to ask is just to get an idea of the constraints, like how many words can typically appear in this input.
Elemental Armadillo: List in this dictionary. There's no good assumption, so we can come with whatever assumption makes sense. It could be N. Okay.
Mythic Goose: Got you. Okay. N words in the dictionary. Okay. And the constraints of this, each individual words also, like, I think maybe we can define it as length. Mmhmm. And any constraints that we have on that, like how long M can get can get to any length, I suppose.
Elemental Armadillo: It can get to any length, yeah. Okay, well, I guess it can be up to 26 characters. Right? Because that's the length of the interview or sorry, that's the length of the string or the alphabet.
Mythic Goose: Okay. Yeah. 26 characters is the length of the alphabet. I was talking about the words in the dictionary. Can they get to more than I'm assuming it's okay to repeat some letters, like Tte here.
Elemental Armadillo: Yes. Okay.
Mythic Goose: 26 characters in the language alphabet. Okay, got it. Okay. So what's a good way to approach it? Let me maybe take this example and play with it a bit more to get some ideas. And I'll be looking to see if I can come up with a brute force first, if there is a brute force. If not, I'll try to see if I can come up with an optimal algorithm right away. But let's see. Brute force makes more sense to me. I'm just going to put them all in one line so it's easier to see. Okay, so let's say that this is the input of the dictionary, and how would I basically know? I know that these are sorted, so that's one thing to keep in mind. And so how would I know if one letter comes before another? So I can compare adjacent words and check to see what is the first letter that is different. So I was thinking for I basically we'll have to do this for all combinations in order to be able to figure it out. So for I and for J. Basically compare words of I and j, words of I and words of j to see first letter that is different and we need to basically indicate that that letter is actually of a lesser value. So maybe what we can do is assign values, so we can maybe use assign values, so maybe we can do something like the ord of the actual letter itself or actually come up with our own ordering for that some way to assign values. It's not clear to me how I would do this yet, but this algorithm would basically mean like we compare every word against the other. So it would be at least an o of N square algorithm, so this would be o of N square algorithm. Without taking into consideration the complexity here, the complexity here would be comparing words of length M, so that would be at least an of M comparison. And then to figure out if some way we can keep them in sorted order and sorted by our own formula, that might be a constant operation depending on how we come up with this assigned values. It's all very vague now, but this is basically order of M, this is order of n and this is also order of N. So seems like an of N square M algorithm that we have so far and we should probably try to do better than that, right?
Elemental Armadillo: Yes. Okay, well let's not worry about the time complexity for now. We can see if we can come back and do better there. Yeah.
Mythic Goose: You need to do sorry, say it again.
Elemental Armadillo: So you say compared words I and j to C first letter that's different and you find the values. How do you store this stuff? Like do you need storage?
Mythic Goose: Yeah, how do you store it? In sorted order, right? Yes. Okay, so for example, is this the output that our function is expecting? Like it's a string, it's a correct?
Elemental Armadillo: Yes.
Mythic Goose: Okay, so then we need to keep a sorted data structure of some kind and then eventually get the output. So if there are values, numeric values that I could assign and I could keep like a sorted data structure, then at the end I could maybe get the elements out of that sorted data structure, keep sorted data structure, insert into sorted data structure by value, by assigned value. And then basically at the end we would visit all elements or basically get increasing order of elements, elements from data structure and construct a string. So for example, if I were to keep them in a heap data structure or something, then I would just continue popping from the heap and constructing an output for that. Now that means that I'm adding extra complexity here. So inserting into a heap will take all of log of N. Oh, sorry, you told me not to worry about that time complexity, never mind. But I just wanted to call out that because we'll have to now maintain something in sorted order.
Elemental Armadillo: Yes. Okay, that sounds good to me. If this looks good, we can begin implementation.
Mythic Goose: Okay. I still haven't figured out exactly how to assign values for these. And should I also try to look for a more optimal approach in this?
Elemental Armadillo: Let's not worry about the optimal approach. I want an approach that works and then we can worry about optimization later.
Mythic Goose: Okay, got you. All right. Okay, so how do I keep this in sorted order? So I haven't actually decided that what values go onto this, and this might actually change the algorithm a little bit. So before I write code, I'd like to make sure that I figure this part out. That is, if the first letter is different, then assign values. So this is basically just going through both words one letter at a time. When you find the first letter that's different, then words of I at that point will basically have a letter that should precede the second one. But how do I know what its absolute position is? I still don't know that yet. So it's possible that this approach won't work. To give you an example, let's say I compared WRF and Er, and I found that W is actually less than E. Like W should go before E. Then I still don't know what E's position is relative to, say R. Right. I would maybe only know that if I continued through the list and found a direct correlation between ENR, I don't know what its relative. Like, if there were letters in between W and E, I don't know exactly where this E would go unless I actually did the comparison to the previous elements. So I don't know how we would assign a value like that. Absolutely. So let me think about that for a second. Do you see what I'm saying, though?
Elemental Armadillo: How do you maintain the relationship?
Mythic Goose: Yeah, exactly. So I need to maintain the relationship somehow. So one way that I can think of doing that is to usually relationships to me signify a graph kind of approach. Like, if I could maintain this somehow in a graph data structure, that would actually help me. So let me see if that would actually help me. Let's say that I found out that W goes before I mean, from the first two comparisons, I would only figure out that T goes before F. So what if I sort it like that? Would that help me? T goes before F and then from the next two letters, which is WRF and Er. Well, actually, my algorithm compares the first word to every other word. I know that W goes before E, so W goes for E, and then after that, from this, I still only learned that. And from here I learned that W goes before R as well. Something's wrong? Yeah, W goes before R. Now in the second iteration, I compare WRF to everything else again, nothing to get from here because the search will stop as soon as I figure out the first word, which is different. So the interesting case comes when we compare Er and ETT. From there, I figure out that R comes before T. Yeah, R comes before T. And then when I compare Er and Don't, I only learn that E comes before R. That's all I can learn from just using the word Er and now ETT. From there, also, I can only learn that E comes before R. So with one pass of this double for loop, if I was able to construct this structure, maybe what I can do is figure out the order from this structure somehow. Does that make sense?
Elemental Armadillo: Yes.
Mythic Goose: Okay. So I compared W to everything else, and this is all I learned. ENR. Okay. Yeah. Okay. So how do I know what comes before? What maybe what I could do is I have ideas of maybe trying to do, like, a topological sort of this graph structure.
Elemental Armadillo: What is that?
Mythic Goose: And the idea of topological sort is, if I built this graph, then the elements that comes before like, if I have that order, the elements that come absolutely before. It's basically building a directed graph from W to E and W to R. So in the final order, W will come before E and before R. Now, the order of ENR will have to be determined by ENR. And I'm realizing I missed a clarifying question. Is it possible to completely deduce the order of all the letters in the words given the input?
Elemental Armadillo: Yes. Let's assume this.
Mythic Goose: Okay. So I think if I did a topological sort here, which is the idea of that is I start at one point and then basically start with any point here and visit all its children. And once there are no more children to visit, then add that element to the output and then go back to the parent. And then once a parent has finished visiting all its children, only then add that to the output. And then if I reverse that list, I would get the topological order. So in this example, if I started at W, I would visit ENR ENR. And when I visit E, I would go to R again. I mean, I would be first visiting R. So I guess I'll need a visited set also to keep track of what's been visited so far. So far, we and R will be in the visited set. Once I come to R, I see T, so I'll be visiting T, and then I find out that T has one child, which is F. So I'll be adding T and F here, and then from F, there's nowhere else. So from here, I would be constructing my output set. My output set would first contain F. Then I'd go to T, and I'll write T and then R and then E. And then W won't be I mean, I'll be writing W because there's no point visiting another child because that child has already been visited. It's in the visited set. So theoretically, if I reverse this, I should be able to get the topological order, which is W-E-R-T-F which at least in this example seems to be the right answer.
Elemental Armadillo: Yes.
Mythic Goose: So then my algorithm basically now is compare each words and make a graph or add to a graph. The graph is going to contain part of the graph is letter to successor. How do you call them? Like letter that comes after successor. Right, successor letters. So add to graph first letter. That's different. Okay, so maybe what I can do is I can get started on the code just because I've taken so long. I'll just start off on the code and then try to figure out these details.
Elemental Armadillo: Okay.
Mythic Goose: Get order of alien alphabet. And we're going to get dictionary. Yeah. Okay. Dictionary of words. And this dictionary is basically a list, so I'll just call it like sorted list of words. Okay, so the first thing to do is iterate through this dictionary and then something that I have to think about. Do I have to compare every single word or can I just do adjacent words? Okay, I'll maybe optimize that after I do the algorithm once correctly. My thought here is probably there's no need to run this loop twice. If it is guaranteed that this will always be smaller than this, then it's enough to check this and this. I don't think I learned anything new about WRT by checking it with Er directly that I won't from WRF, but I could be wrong about that. I'll check that assumption at the end, if that's all right. Okay, so let's just call it the graph. It's basically going to be like a dictionary and then for I in range, let's just call that N actually len of sorted list over it range N and for J, j needs to start from one past I, so I plus one to N. And now I need to compare the two strings letter by letter. So I have a question here. Okay. So let's say that I have ABC in the input, like I'm on line 44. Or I can just write it here too, like just about the code. If I have the word and ABCD, can this be possible in the input? Because it's still sort of.
Elemental Armadillo: Yes, let's assume it's well, I mean, I don't think you learn much, right? What do you learn from there?
Mythic Goose: Yeah, you don't learn anything from there. Okay, so it's enough to compare just the first M characters, right? Okay. Yeah, that makes sense. So what I need to do is compare two characters. Let me just comment this out. Oh, that's cool. Okay. I have two strings words of IJ. First is equal to words of I and second is words of J. Now I need to compare both of these character by character. So I could probably just zip and compare letter by letter. So for say, first character and second character from in zip of first and second, I need to look up the Python definition for zip once again, whether it'll actually work with sorted list of words. I'm just going to write the two words first and I'll refactor this for sure. This hopefully won't throw an exception. This should just take as many characters as there are available. And the first time, if the first character not equal to second character, that's when we need to add graph of first character append to second character. Then it becomes a good idea to make our graph a default dictionary. Default dictionary and then import that's a list so it'll always be initialized and we don't have to worry about first time appearance of first character or something. And so if this is the case, then we can break away and then move on to the next word, next two words. If not, we learn nothing and then we don't insert anything into the graph. So this should produce the graph. Let me see if I'm missing anything at all that's words of in words of J. Yeah, okay. Character, second character. And this is it. Yeah. Okay. So this is constructing the graph. Now the idea is we need to try and get a topological sort done. So let's write a helper function for getting the topological sort and that takes in a character and we need to find the adjacent characters. Two questions here is how do we like it is possible for us to get the ordering always? Okay, so then I can begin in theory with any random character. So let me actually write the topological sort and then I can figure out how best to go about initializing the search for topological sort, I mean starting off the topological sort. So I need a visited setup and I need output list which is basically output which is a list. And the idea is once I call helper I'll be writing to the output in reverse order. So the first thing to do is add this character to visited. Second thing to do is for successor error in graph of that character. For each successor character in the graph of just that character, we need to visit successor character if it's not already visited. So if successor character not invisited, then we visit successor character. Then finally we add the character to the output list. Then at the end, after we call helper and I don't know how I'll start this, maybe I can just start with any random letter. No, if I start with any random letter it won't actually know which to compare. So it would help if I had a list of all the letters A through Z and then start a topological sort with all of them so we can actually limit it to the input as well, but the idea is we need to return. So once we start this, then we need to return the reverse of the output and the reverse of the output in string format is what our question asks for. So this would be what we would return. I haven't figured out how to start this. One option is to start it for every letter. So for letter in C-D-E-F-E-H-I-J-K-L-M-N-O-T-Q-R-S-T-U-B-W-X-Y-Z If letter not invisited, then start the topological sort from that letter and then just continue. But yeah, I'm not sure, if we only had a few letters, then this would be overkill. We would be going through how do we do it?
Elemental Armadillo: Yeah, I mean, it's fixed cost, right? It's again length 26. But the thing is, the alphabet could be longer than that too. Since you're using Latin alphabet, it's 26 letters, but theoretically it could be longer than that. Looking at the graph itself, how do.
Mythic Goose: You know the letters right? The input letters? We can try to use the graphs keys. So, for example, when I drew this graph here, let me just copy and paste it right above the question. If it's guaranteed that there are relationships between every element and it's possible to guess the output, we should be able to start with any one of these Wrtne. So maybe we construct the graph first like this, and then after that just use the graph's keys for getting each letter since the order doesn't matter, right? So if that's the case, then we should be able to determine the order. What I can do is, is it okay if I run through this example with whatever code that I've written?
Elemental Armadillo: Yes, let's do it.
Mythic Goose: Okay, so let's say my algorithm says let me just reduce the font size. Can you still see?
Elemental Armadillo: Yeah. Okay, sorry.
Mythic Goose: I'm in line 59. Okay, let me just make my window full screen and then I can run through this. Okay, so what do I do first? I first create a graph G. And then let me see if my algorithm actually does what it says it'll do. So first we are comparing and the input list, I'm just going to copy and paste that too, real quick. So this is the sorted list words. And I'm going to start at index 01234. So my I is here starts at zero. J would start at I plus one. And then I would compare I would do a zip of both of these. So that would be WRT and WRF. And then I would take first character, second character, Nwrt and WRF, compare them. And then I'd find out that T is different. So then I would write T comma f into the graph. Then I would expand and move J to E. And from here I would zip both of them. It'll have WR and Er, if I understand how zip works correctly. And then I would compare them character by character and I would get W and E. Then J moves again to I plus one. So we compare W and E again. And then oh, okay, here's a problem. A problem is we could end up with duplicate comparisons. So I could have duplicate characters in my output value. And one way to avoid that is to make it a default dictionary of a set. So, for example, when I compare WRT and we are versus WRT and Wett, I would just be appending to a list, which means it'll be two easier. So instead of that, I'll just use a set, which should solve that problem. So when J is here, it solves that. And then we compare W and R. And then I drag R here. And now I moves to this, J moves to E again. It's the same thing. Because we're using a set, these values will be overwritten. I mean, it won't be written into the set. Now is an interesting thing. I and J, you compare I and J and then compare character by character, R and T. And first character is not equal to second character. So we append oh, now we cannot append, we have to add. And we add R to T. Now, this relationship and then J moves to four. I have made sure that it's I plus one, right? Yes. Okay. J moves to four, and we compare ENR this time and fails there. And so I break out of that loop. Okay. So then finally, we use I and J, we find ENR, relationship fails there, and then finally we come to I and there's nothing for this to compare. So the second loop won't run, and we exit the loop and we get the graph structure. So this should work. This part should work. Now, the topological sort part, I could start with T, because I'm checking to see for letter and graph keys. So I could start my journey with T, but that shouldn't matter because we're still getting it in topological order. But let me confirm that. So I start with T, and then from T I add it to the visited. My output still doesn't have anything, and from T I go to F. Add that to visited. From F I go to nothing. So basically, F gets added to the output and T doesn't have another child. So that also gets added to the output. Now, in the next iteration, I run W, and for W, I first add it to the visited, and then I check to see each of its children are they visited for successor character, if not invisited okay. Helper of that success character. Okay, yeah, I think that part might work. So for W, sorry, I was at W now, and the first thing that I'll visit is E. And for E, the first thing that I can visit is R. So on the way here, I would be adding we and R, and then from R, there's nowhere else to go. Oh, wait, from R I can go to T, but T is already invisited, so I add R there. Yeah, T is invisited, so I add R there and then I come to E and from E yeah, E has no more children, so I just add E and then finally add W. Is this the right order though? W-E-R-T-F-W-E-R-T-F? Yeah. Okay, so that is the right order. Okay, so should I try to run this and write some test cases or something?
Elemental Armadillo: Yeah, let's run it.
Mythic Goose: Okay, so for maybe we can just run it with the example that you did provide me.
Elemental Armadillo: Let's do that.
Mythic Goose: Yeah. Test one normal case and let's say words is this. Oh, and output is get alien alphabet awards and we want to print the output. Let me bring that through. Graph keys dictionary changed in size during iteration. I'm not mutating a dictionary, so it shouldn't actually change inside. Oh, by the way, okay, I see the character was not there in graph. Okay. So maybe what I can do is just make a copy of the keys. So letters is basically graph keys and I think it's called copy. I can just say list updates. So WRTF, I think is the right WRTF. Yes. Okay, so now maybe we can test some edge cases. So this time word is empty and then I'll just copy it and paste this. Oh, I need to comment this out, I think.
Elemental Armadillo: Okay, yeah, I think you printed an empty output.
Mythic Goose: Okay. Then the next one is test just one word in here, words. And in this case, all we can expect to get is W. So I think that should be the output. Let's see. Yeah, we're not getting that. And let's see what the reason is. The reason is I've always started it from I plus one, so I won't be able to get the range based on that. So maybe what I can do is I can handle that case separately. So for example, if the length of this if len of words equal, equal to one, just return words of zero of zero in a list format. I don't think I can modify my algorithm to just ensure the next words because there's literally nothing to confirm.
Elemental Armadillo: That'S fine. Can you give me an example of this scenario where take words and output and what I want to see is an incomplete set. So can you provide a set of words with which you're not able to get the order and what the output would be then? So what if you remove WRF from the set? What happens then?
Mythic Goose: What if I removed okay.
Elemental Armadillo: WRF from the set?
Mythic Goose: Okay, I see, so basically we want to test the case where it's not possible to infer an order, right?
Elemental Armadillo: Yeah.
Mythic Goose: So if WRF was. Not there, then how would we ever determine the relationship between W and F, for example? Right, yeah. So in this case yeah, we wouldn't be able to determine that. The only way I could have done that is if there was some other word that contained W, which would force a comparison to F, which I don't.
Elemental Armadillo: I guess my question is then if you're not able to determine the order, I want you to throw an exception saying you're not able to determine the order of all the file of the alphabet.
Mythic Goose: Okay, that makes sense. So what I could do then is we know that output figures out some order. So if len of output not equal to len of or is actually less than length of letters wait, letters is whatever we do have a relationship for in the graph. So I would actually need to figure out all the letters in the input itself and all the unique letters in input. Okay. So let me handle that case as well. So let's assume that all input letters was something that was there. Then I would need to raise an exception unable to infer order among alien letters, and then just return from I mean, if I'm raising an exception, we'll return. So all input letters needs to be constructed with just by going through every word. And then so one thing that I can do is first join all the words. So join all the words into one giant letter and then create a set of that. So this is all unique letters. So this should actually take every word, join it into a string, and then make a set of all the unique characters. Now we're raising an exception. Is this what you were looking for?
Elemental Armadillo: Yes.
Mythic Goose: Okay, I see. So the input actually does give us the can actually put us in a state where it's unable to actually complete. Right. It's unable to actually figure out all the letters. Okay, got it. Okay. I should maybe have clarified that. Yeah. Makes sense.
Elemental Armadillo: No, I think we can move to the feedback. We can move to the feedback part.
Mythic Goose: Sure.
Elemental Armadillo: So I think yeah, overall positive feedback, I think what let's see. So I think it was good that you verbally explained your approach. I think you talked about the constraints in the language alphabet. No, dupes n words in the dictionary. I think that's all great. I think you started with an initial approach and then you proactively talked about time complexity, which is good. And then you also talked about how you need to use topological sort. That's good as well. So, yeah, let me write down these notes. I'll just put these as notes. So I think positive is writing down as much pseudocode as possible, which I think you did beginning pseudocode as possible around your approach. I think another positive is for communication in general. I think your communication was crisp and clear throughout, and it was always clear what we were trying to do. And you were verbalizing as you were talking sorry, verbalizing as you were coding. So that's great. Another plus is you concluded that topological sort is the way to go, and also you also concluded that way to go. Okay. Yeah. I think you also concluded that you graph structure to maintain relationships. I think that was good. And then what's the final thing? I think you proactively tested test cases. So I think all in all, I couldn't really find any flaw in your approach. I think the one maybe question mark I would have is not really a question mark. I think you came up with an I think you proactively talked about time complexity. I think that's a good plus. But proactively talked about time complexity. I think at Facebook, they would want you to generally at many companies, they would want you to implement stuff and worry about time complexity later. Like, can you optimize later? Google wants to come up with the best time complexity solution so that it really depends on the company you're interviewing and stuff. So I don't think there's any wrong approach. Yeah, I see.
Mythic Goose: So Facebook wants code first and then.
Elemental Armadillo: Exactly. Yeah.
Mythic Goose: I see. Yes. I've also heard that Facebook tends to ask not one, but two questions. Is that right?
Elemental Armadillo: Yeah. So Facebook asks you an easy question. So think of an easy question as, like, given two strings, calculate the output. So, like, lead code easy, and then one lead code medium, whereas Google starts with the lead code medium, and then it can be a lead code medium hard. So, like, medium but approaching hard mode. I think that's kind of what Google likes to go with. And Facebook goes normally, like, easy one and then a medium one. And if you solve the easy one, you need to solve it within 20 minutes so that you get the opportunity to work on the medium one.
Mythic Goose: Okay, solve it in how many minutes?
Elemental Armadillo: I would recommend solving the easy problem that the Facebook has. Within 15 minutes.
Mythic Goose: Within 15 minutes. Okay, got you. So that there's, like, 45 minutes for the is it 45 minutes the interview, or is it 1 hour?
Elemental Armadillo: It's 45 minutes.
Mythic Goose: Oh, it's 45 minutes. Okay, got you. Okay, got it. So then I'll have 30 minutes to maybe work on the harder problem. Right, okay, got it.
Elemental Armadillo: Yes, exactly.
Mythic Goose: Okay, understood. Yeah. I'm sorry. Go ahead. Please. I cut you off.
Elemental Armadillo: You want to pace your interview so that you have 30 minutes to do that.
Mythic Goose: Okay, got it. Yeah. Understood. Okay. And are the questions asked usually this complex or like this one? Is it a hard problem?
Elemental Armadillo: I think this is medium or could be medium hard. I don't know off the top of my head. But Google loves to ask these kind of questions, and they'd rather ask one question that requires a lot of thinking and maybe some code, but they always prefer to stick to one problem.
Mythic Goose: Okay, got it. Okay, understood. Okay, cool. And any advice for me, like, in preparations for these, assuming you don't have to run away, do you have, like, five minutes?
Elemental Armadillo: I do have five minutes, yeah. I don't really have any.
Mythic Goose: Mean I.
Elemental Armadillo: Don'T really have any specific advice for these companies. I'd say for Google, they want to optimize more for algorithms, and they want to ask you algorithmically tough questions. So you want to think about preparing for graphs, dynamic programming, sorting, so things that are generally considered algorithmically tougher, whereas Facebook will ask you slightly easier questions, but they care about how quickly you're able to write the code for a problem. So they'll ask you things like string manipulation or arithmetic problems or data structures, simpler data structures, but they expect you to solve the problem.
Mythic Goose: Got you. Okay, understood. Okay, thank you so much. And what was your journey like for this? Did you get both offers, or did you stop at facebook or what was that like?
Elemental Armadillo: Well, I stopped at Facebook. Google I interviewed when this was like, about, I want to say 1314 years ago. Facebook, I interviewed around ten years ago. I was able to solve this problem, but I didn't really get through the offer point. But Facebook, I was able to get the offer and then from there.
Mythic Goose: I see. And did any mode of practice help you? Were you practicing by patterns, or were you practicing random questions when you were preparing?
Elemental Armadillo: I was practicing random questions, really? To make sure I got the entire set of questions answered.
Mythic Goose: Okay, got you. Okay, awesome. Thank you so much for your help. Really appreciate it.
Elemental Armadillo: No, likewise. Thanks a lot. And yeah, best of luck for the interviews. Again. I think you're doing just fine. Your communication is strong problem solving ability and stuff, so I don't really see any much issues there.
Mythic Goose: Got you. All right, thank you very much, and have good yeah, you too.
Elemental Armadillo: Thank you.

We know exactly what to do and say to get the company, title, and salary you want.

Interview prep and job hunting are chaos and pain. We can help. Really.