Watch a technical mock interview with a Microsoft engineer
Mighty Hamburger, a Microsoft engineer, interviewed Sartorial Jaguar in C++
Share
Summary

Problem type 

Odd even tree

Question(s) asked 

Given a tree, verify that on even levels, all values in the level are strictly increasing and even. On odd levels, verify all values in the level are strictly decreasing and odd.

Feedback

Feedback about Sartorial Jaguar (the interviewee)

Advance this person to the next round?
  No
How were their technical skills?
2/4
How was their problem solving ability?
3/4
What about their communication ability?
2/4
The problem I gave was Leetcode 1609: https://leetcode.com/problems/even-odd-tree/ 1. Explain thought process more before starting to code. 2. Clarify constraints first before starting: -can tree be empty -can there be negative numbers -can numbers be the same -can numbers exceed c++ max/min int 3. you said "copy paste" -if you think u need to copy paste, maybe it is best to create a method but pass in the parameters that make it slightly different for example checkEvenOrOdd(List oneLevel, true) 4. volunteer to run through a test case yourself, in a real interview if u say im done and dont run through a test case then thats your final answer and you dont get a chance to catch any mistakes Learn BFS, DFS, check out "Cracking the Coding Interview"

Feedback about Mighty Hamburger (the interviewer)

Would you want to work with this person?
  Yes
How excited would you be to work with them?
4/4
How good were the questions?
4/4
How helpful was your interviewer in guiding you to the solution(s)?
4/4
Honestly not much to say here, very helpful and personable. Was accomodating in the way that I wanted to practice C++ for the interview and even though he wasn't familiar with it, he did his best to follow and caught all my slip ups.
Transcript
Mighty Hamburger: Hello. Sartorial Jaguar: Hello, how are you? Mighty Hamburger: Hey. I'm doing good. How are you? Sartorial Jaguar: Great. Mighty Hamburger: Great. So this is actually one of my first time interviewing someone. So I hope you cut me some slack here. Sartorial Jaguar: Oh, yeah. No worries you this my first time doing this too. Mighty Hamburger: Okay. Okay, fantastic. So we're both pretty new. I just pulled a question off leetcode. So I hope you're okay with that. That's what I assumed. Yes. It's okay? Okay, fantastic. What language are you planning to do this in? Sartorial Jaguar: So, my main language, language I like to use in interviews is C++. However, I'm interviewing for an embedded position. So C or C++? Mighty Hamburger: Okay. Okay, you can pick either of those up, see you there. I actually don't know C++. I did learn C in school, though. So it has been a while with the pointers. But hopefully I can I at least understand what you're trying to get through your explanation. I probably won't be able to correct many of your like, you know, like syntax or like language specific. You know, things. Sartorial Jaguar: Okay. That's like a pilot for it. This is more just for getting the hang of, like, at least from my perspective, it's more for getting the hang of this out loud. Questions. Mighty Hamburger: Definitely. Definitely. Okay. Cool. Cool. As long as we're on the same page. Okay, so this question I'm gonna give you, it's called even odd tree. Okay. Oh, have you ever done that before? Sartorial Jaguar: Maybe, uh, maybe off the top of my head. Mighty Hamburger: Okay, I'll continue explaining. And if you you think you've done it before we can I have another question prepared, but we can switch to. But for even odd tree. So you have a binary search tree, you're given the root of the tree. And for it for a binary tree to be an even odd tree. That means at every level of the tree, for example, let's say the root is given its level zero. And then let's say it has a left and a right children, those children will be at level one, and their children will be at level two, and their children will be at level three, and so on. For every even index level, so 0 2 4 6 8, and so on. All the nodes in that level have to be strictly increasing from left to right. So for example, like we said, if you're given the roots, that's only one value, so that's fine. But let's say you have a bunch of children. And then on the second level, you see like one has a children of three one has, and then he goes like seven and then nine, that's strictly increasing. So then it's valid. And then the same thing for the odd indexed value, index levels sorry. All the levels at that level have to be even, and they're strictly decreasing. So I will, I will type out the exact parameters here for you. Okay, there's a mouthful there, but hopefully you can understand. And I can I can draw you an example to if you. Sartorial Jaguar: Yes, please. Mighty Hamburger: Yeah, okay. Okay, so let's say let's say we have this tree and squat, you can see the drawing pad, right? Sartorial Jaguar: Oh, wait, so you're saying at every even index level? So a level two, there can only be odd numbers and only be okay. Mighty Hamburger: Yeah. And they have to be strictly increasing or strictly decreasing. Sartorial Jaguar: Okay, so I'll put up my head, the first thing that's going through my mind is it's going to be I think it's gonna be recursive. And I'm going to be passing the level to each recursion call. So I'm going to be passing whether it's like even or odd or whatever. And, anyway, sorry, keep going. Mighty Hamburger: Okay, do you see the drawing pad? Sartorial Jaguar: If I click drying mode? Yes, I do. Mighty Hamburger: Yes. Okay, perfect. So as you can see, this is the root, so that's level zero. This is level one. And then this is level two, right? So you have like, levels in the tree, right? So you can see on level one, it's an odd index, because it's level one. And then we have 10, and then we have four. So 10 and four are both even, and 10 is decreasing to four. And then for level two, it's 3 7 9. They're all odd. And if they're all increasing, three goes to seven goes in that and so that's in the binary valid tree. Sartorial Jaguar: Okay, so does not have binary... Sorry. I got the terms mixed up. Keep going. So when it's when it's when it's when it's odd, they have to be decreasing from left to right. And then when it's even, they have to be increasing from left to right. Mighty Hamburger: Yes, correct. And yeah, so you just had to return true or false if it meets this criteria or not. Sartorial Jaguar: Okay, I'm not entirely sure how to compare whether it's increasing or decreasing across recursion calls. I got to think about this one for a sec. Mighty Hamburger: Yeah. So yeah, I've given some time. Think about how you would do it. Sartorial Jaguar: This is a hard one. Mighty Hamburger: Yeah, it's a little tricky. Sorry, if it's too hard. You did specify intermediate, so and this is medium on leetcode. Tree questions can be very tricky. Sartorial Jaguar: Yeah. Yeah. Alright, you know, I'm gonna start going through it a little bit. And I'll think about it as I go. I just typed in this little thing, right? Mighty Hamburger: Yeah, yeah, you can type in this, I can see the top right hand corner, we can change it to like, C. So yeah, let's see like, interface or you can change it to C++. Yeah. See? Oh, up to you what you want to use. Sartorial Jaguar: C++. Okay. So I'm gonna start with a boolean. Even odd... Take in? How is this defined? How is the tree structure defined? Mighty Hamburger: How is the tree structure defined? Let me give you the interface for that in C++. So you're given a structure, you're given a tree node pointer to the root. And sorry, I lost track of my window. Give me a second here. So it should look like this. Okay. For all the commented out parts. We can try copying it. But I hope that makes sense to me. Okay, there you go. Perfect. And for the... Yeah, you're given a treenode to start. Sartorial Jaguar: Okay, so when you're in the tree nodes, there's two recursive calls, usually. So you have your base case, and then you do your two recursive calls. And then you do stuff after that. So once you do the two recursive calls, then you actually have the data. So once I'm at zero, when I do the two recursive calls, I'm going to have 10 and four. However, when those ones go in, so when four goes in, and it gets 7 9... 7 9 has no idea what three is. I have an hour, right? Mighty Hamburger: Yes, yes. Sartorial Jaguar: Take a sip of coffee. Mighty Hamburger: I can maybe give you a hint, if you would like? Sartorial Jaguar: Are you allowed? Mighty Hamburger: Um, I think technically yeah. But like, okay, let's say if there's a real interview, it'll probably be like, you know, a little mark against you, basically. Yeah, that's fine. I mean, this is practice right. So I feel like if I it's better if I give you a hint and you actually like, try then just leave out again fully stuck, right? Yeah. Then just call myself. There's there's two suggestions I might have. So you're you're on this recursive method right? Do you have to use a recursive method to go through a tree. Can you do it iteratively? And that's my first hint. My second one is, if you have it in one recursive call, right, but you don't have it in another recursive call, maybe there's some way for two things, two recursive calls to share information. That's different. So there's, there's, there's almost like two approaches I gave you. Sartorial Jaguar: Okay, so I shouldn't have just jumped right into recursion, I think it should have been a little more. So I'm gonna look into iteratively. So the iteration is going to stop once there is no nodes to go to. Or if the condition isn't met, so if there's no more nodes, it's going to return true. If the condition isn't met, it's going to return false. Okay, so that's going to be while something I'm not sure what the condition is yet. So at every stage, I want to create a list of all nodes to be compared. Wait a second, I could flatten the tree. Hmm. Let me think for a second on how to flatten a tree. I haven't done that since like, third year. Mighty Hamburger: Yeah. It's been a while has, yeah. Sartorial Jaguar: What restrictions do I have in terms of space and time? Um, for now, I don't think you have to worry about that. I think as long as you can get a solution. I'm fine with any time. So if you if you want to, like look through the tree and n squared time, go ahead. You know. Mighty Hamburger: That'll be fun. So as interviews are hard to find this question at work, I just Google it. Yeah. Yeah. How to flatten. Sartorial Jaguar: When you say flatten, what are you trying to get the tree to be? Basically, when can I ask? Because I sort of still don't get your thought process. So I'm not sure I can help you anymore. Mighty Hamburger: So when I mean, flattened, I mean, change it into an array. So in my mind, I'm picturing what this drawing would turn into is... Sartorial Jaguar: How about how about you take the example tree that I wrote and, like, pretend you can do magic and turn it into any array format you want. What would you make that into and how to solve your problem? If that's the troubling part, then I can say, okay, fine, you can have this array, and pretend you you have a method for that. And we can, like continue with the rest of the problem. Cuz like that, and that's a thing. That's just like something... Oh, like, there's no function or something that you would have been able to look out, you know, like at work. And I don't want to like penalize you for that. Mighty Hamburger: Right. Okay. Yeah. So yeah, so, an interview If this happens, and I have to do need to helper function flatten in this case. I can just flatten. Right. Yeah. Okay, so I'm going to want to do an array. I'm going to do an array that is how I would change this into flatten. So it would basically just be, it would be one or so it'd be 1 10 4 3 7 9. And I know you can do that recursively I cannot remember how that's what flatten does. Sartorial Jaguar: Okay. Okay, so Okay, let's pretend we have this already. Can you write the rest of the, the, the methods to check if it's even odd? If you're given this array now, so, yeah, let's say we have like, boolean, even odd tree array. And you're given this, you know, I don't know how to close those days like that. So C plus, I probably, I probably use an object. So I'd go Okay, yeah, you can change it to whatever you want. So can you write that out, and then... Mighty Hamburger: The list would be, I guess, it would be a list. So I have a for loop now. For loop that starts with zero, which is head. For loop ends at list size, because lists to get the size of this sub lists, you call the actual util, list, zero dot size, or list one dot size. So this will just be groups dot size, or length, I believe it's the size. Now, a second one, or 10, four or 3 7 9. So the restrictions are, for every even index. x for evening, I'm going to do pseudo code, check for even index. And then the other case is going to be for the check for even index, I'm on to look to, if i module two, is going to be one, five to zero or four is going to be zero to now, to check every member of sub lists, see if next one, is going to be kind of the same thing. It's the opposite event. Perfect. And so once so once this thing goes through, that will return true. However, if any member if it is even, I'm gonna put this inside the case. If any number here is even return false. If any number is even index have to be strictly increasing. If any number is larger than previous term false. That's going to be the same thing here. Except the opposite of course. And that's decreasing smaller. We just finished this statement here to make this even shorter. Okay, so now I have my pseudocode. Sartorial Jaguar: That looks great to me. Yeah. Are you able to code it? Mighty Hamburger: Yes, I am. I like to type out all the pseudocode first as much as you can. Sartorial Jaguar: Yeah, that's, that's very good. You should be doing that. Mighty Hamburger: Yep. So I'm going to have int j, in this case, since I've taken exclude zero, J will end. Root? I think less is less than or get or at. Or get you that's just the job... Sartorial Jaguar: That I don't know. I'm gonna, I'll allow you to, like, look it up if you need. Okay, you know, I'm pretty sure it's, I'm pretty sure you can just do this in C++. Oh, my latest project that works in C++ also. So that's why I'm at this is what I've been doing today. So if j is less than the root, root j, no root i dot size. This is comparing root i is the current sub list. So right now i is zero, it will just be one, size one, it would be 10. Four. So check for even. If j modulo 2 is even, that's going to be true. No, that's going to be false. Now I need a way of tracking the previous number and the next number and all that. So I'm gonna actually have a starter. What are the restrictions on these numbers? Can they be negative? Mighty Hamburger: Ah, that's a good question. They can be negative. Sartorial Jaguar: They can be negative. Okay, so what is the smallest and largest value they can be? Mighty Hamburger: The smallest will be negative 10 to the six. And the largest would also be 10 to the six positive. Is that greater than C++ size? Sartorial Jaguar: Not like four or eight. Usually it's it's an increment of four, eight or something. Mighty Hamburger: Oh, it's a million C++ can handle that. Right? Sartorial Jaguar: Yeah, so it's a million, right. Okay. Yeah, so I'm going to do so if right now we're checking if any number is larger than previous. So it's either gonna have to be negative a million or positive a million. I'm trying to figure out which one of those right now. Even index strictly increasing if a number is almost the law of odd integer values and strictly increasing. Okay, so this statement I had here is wrong. If any number is smaller than the previous since it's strictly increasing. Numbers smaller than that want to be larger. So I'm gonna have equals the smallest possible number that we could have. So that's negative a million off the top of my head, depending on the compiler, I believe this is 16. Can that work? I'd have to double check to see if that can work with an int. Off the top of my head, I'm not sure if the default int in C++ is 16 bits. I'm not sure if 16 bits can be 1 million, so I'd have to double okay. I mean I can try to look that up for you right now. Mighty Hamburger: Okay. Okay, so it says in C flat C++ int min is negative this. Okay, so it's like negative 32,000. Right? is negative 21474836489? That looks like it covers a million. So I think you're good on that. Okay, so I'm good on that one. Okay, so and I assume you're saying that's assume you're good on the maximum too. Sartorial Jaguar: Okay. So right now, I'm going to be comparing to decent, I'm going to have the smallest. So if root i, j, that is the current element is increasing is bigger than smallest. I guess last isn't the most accurate way that's going to be most helpful previous. If that is bigger than previous, and the first element will, I guess bigger than equal to first element could be negative 1 million? Are they allowed to be bigger than or equal to each other? Or do they have to be bigger than what is increasing mean? Mighty Hamburger: There has to be strictly increasing. So if they're the same, then this would be false, basically. Sartorial Jaguar: Okay, so I'm actually going to do negative 1,000,001. Then because the number can be negative 1 million in which case wouldn't glad you caught that. So if that's bigger than previous, we're going to do stuff otherwise earn false. Stuff we're going to do is smallest previous roots. Okay. Let's go through and double check. In previous, the smallest possible number that this guy can be is negative 1 million. So if it is negative 1 million. And let's say the next one is also negative 1 million. I root j this root... Yes, that works, I believe. So now I'm going to code the next part of it equals one on 1,000,001. For my OCD, put that there. Or I could just copy that, but I'm trying to copy paste as least amount as possible. Another dev I used to work with is that. j is less than size plus plus. Now we're going to check. So we're on an odd index. For an odd index, we have to see if they even. Okay, so I'm gonna be doing that guys true. That guy's true, then that number is odd, and I should return false. Then we do a similar thing to the other one, except we actually reverse the sign. Less than because we're decreasing. I think we're in pretty good shape here. Mighty Hamburger: Oh, yeah, looks good to me. Um, can you run through this code with the example tree I gave you? Sartorial Jaguar: Yes, I'm going to do that out loud. So we start off for integrals zero. I'm actually going to, I can just track this case. So n equals zero all that stuff. If I is equal to zero if I modulo two returns false. That means module two is zero. Cannot this actually isn't the most readable. To me at least. So I'm going to change it back. Mighty Hamburger: Okay. Shouldn't line DB the arrow and there won't be one. If even it is module two equals zero, no remaining. Sartorial Jaguar: Okay. So I modulo two is zero, which it is it is zero. So now I have this in previous, I'm actually going to keep track of this previous guy up here. Equals currently negative. Now, we're actually in this guy. Now we're that we're in here. J if j modulo two returns if j modulo two is zero. J is zero. Wait a second. That's not right. Mighty Hamburger: Ah, good job. He caught it. Yeah, yeah. That's why that's why I ask people to run through their code. Yeah. Okay, if it's not then return false. Line 87 as well. Yeah. For previous, okay. Sartorial Jaguar: All right. So that will keep going. Okay, is that returns one. So this guy passes. So now on to the next one is one bigger than that? Yes, it is. Now previous is set to one. So we are actually at the right size. So now we increment or we exit this guy exit this. Sorry, you can't see my cursor, we exit this loop. We go to here, this doesn't apply that doesn't get triggered. So then we go, it's probably a good idea to actually, I'm going to keep track of all these. Now I is equal to one. Correct. One modulo two is one so this guy doesn't get executed. Now we're on to this guy. Previous is now 120001. j zero. keeps track of root by typing so i j is so is 10. 10 modulo two returns zero we're good there. Is it less than previous? It is. So now previous is 10. increment j is one root ij is four. Four modulo two returns zero. So we're good there. Four is less than previous. So we're good there. Previous is now equal to four. So roots J is now root size. I tried to keep track of root size up here to j is equal to root size exit there, we go to the next one. So now we increment i again is two j doesn't exist anymore an hour on under here, we're on to this guy, because two modulo two zero, the previous is set to negative 1,000,001. Okay created and root ij is three is three modulo two returns one. So we're good for this check. Three is bigger than negative 1,000,001. Previous equals three increment j ij is now seven. Seven modulo two is one. So we're good there. Seven is bigger than three o increment where you change that one to seven, we increment j. J is equal to two, i is equal to nine. Now nine modulo two is one is bigger than seven. So previous is nine. Now, j is equal to root i dot size. I is incremented. I is now equal to root dot size. So we actually return true this is a valid tree. So now, now I would go and I would test an invalid tree. Let's create an invalid one. Let's say first one still good. Let's say this number is negative 1,000,002. Everything else is okay. It's just that one thing. And one. I don't know. These guys have to be 1 5 9 maybe? Yeah, it doesn't matter. Mighty Hamburger: I think the negative 1,000,002 would actually make your code get messed up. But I think as we as we defined earlier, you wouldn't get a number like that. So maybe just try putting in like an odd number. All right. Yeah. Sartorial Jaguar: No, I'm never going to be that it's never ever. Yeah. So I'm gonna try negative 11 instead. Yeah, yeah, yeah, I tried negative 11. And yeah, yeah, that was that was the bounds. That was a requirement. Yeah. Okay, so we're going to try this one and this should return false. Wipe all of these guys. No j no previous no root anything. Okay, so we started root i equals zero. Okay. Is so I'm onto the two is I'm not sure the two equals zero. So we go into this first one. Can you see it when I highlight stuff by the way? Yeah, I can see you highlight. Okay. your mouse pointer. Okay, so now we create. We have previous previous appear equals negative one, and j is created equal zero. I j root four equals three. Three modulo two equals one equals one. So yeah, obviously that one's okay. Previous is now going to be three. And we are at, I guess eight or j gets incremented. We are at that size. Next blocks doesn't get called because this condition. So I've incremented lad, J is no longer is incremented. Previous is no longer but it's about to be. So now we're on this guy that should fail it. Negative 11. Now I'm on to low to negative 11. Module Two, Article One or negative one. I think it should be. Mighty Hamburger: Hmm, that's a good question. I'm not sure about C++. But I think in Java, it should just be one. Okay, can you maybe just google it? Or I can I can I can google it for you, C++, negative modulo? Sartorial Jaguar: Okay, no, I don't actually know. However, I know how to accommodate for both cases. So if it does return negative one, I would actually change my code accordingly. I would call the add function. So I would compare the ABS value so it would actually just compare. Mighty Hamburger: Okay. Okay, that's, that's perfect. Yeah, that definitely solves the issue. I put that in here as well. Okay, so we're good there. And knock it out here because we're comparing this guy. So previous, currently, is 1,000,000,001. Sartorial Jaguar: And negative 11 is less than that. Mighty Hamburger: Then negative 11 less than that, so we're actually good there. Negative 11. Sartorial Jaguar: Now we increment. J is now one through ij is four. Wait a second? Well, and actually, what do they know? 11. Right. Yeah, that's about it. Yeah. Okay, I'll get I'll get ahead of myself. Okay. Well, yeah, they're gonna love them. What actually, I think we can safely say it's, it's, it's good. It's working. Mighty Hamburger: Yeah, I agree. I think you did everything, right. We can we can pretty much stop here. Um, I would say, do you think maybe you can think of a way in like, I don't know, we only have 15 minutes left? ish. So like, the bulk of the problem here? Or like, you sort of did half of it? Which is the tagging is layer part? Do you think you could think of anything? For the, like, you flattening the tree into this array format? Do you think you could do that? If you can, it's fine. Like, maybe just talk about it, you don't have to code it up? Or just like write pseudocode? even maybe. Sartorial Jaguar: Okay, so I know what I'm gonna do after the steps. So the first the first step inside the function call is going to be if there is node left or sorry, if the node that if the current node that passed in is null, I'm actually going to put that in. Mighty Hamburger: So if you can, like right like you, you wrote down some very good comments in your in your other code. So like, maybe just do something like that, and I can get the like a general idea, you know. Sartorial Jaguar: Where it is now on return, you might have to return something however, I know that this is the this is the base case, this is the case where it ends. So then the next cases would would call root left, the next thing would be a function call to root right. And then after that, you would actually add to an array and part of this is actually going to be passing in an array. So for the very first call, I would actually be bool, even odd tree node. Next, I would actually return the value because this is based on the leetcode. Usually they give you the thing that the test cases are matched against and this is the... This is the word I'm looking for whatever this is, this is the correct one with just one treenode argument. So now I'm going to call. Let's call this recursive. Turn even its tree recursive route and new with this guy, and that guy would return a list, I assume or. Yeah, so with new pointer or something, I can't think with that right now. Mighty Hamburger: Let's just try to get, like something like that. It's great. Okay, I get it. Okay. Okay, cool. We can stop here, I guess. I think, overall, pretty good job. Although, we did sort of split the problem into two. So if this was like a real interview, like, technically you, you got, like, half maybe three fourths of the question. Like the the tree recursion part. That is a big testing part of the problem. Like, are you able to recursively go through the tree? Right. So I think that's something you you should know, just pretty much you got to memorize it. It's like, I don't know. Did you go to university? Yeah. For Computer Science. Okay. Like, I'm sure you lead like BFS or like DFS, right? Yeah. Sartorial Jaguar: So I did my degree. I graduated in 2019. And then I've been working then. So I haven't done recursive trees. I've done a little bit a while. Mighty Hamburger: I feel you I feel Yeah. Yeah. And like, usually I work like, usually, no one uses trees and whatever. But like, unfortunately, I think in a lot of these interviews, people will give the tree problems because it really like test, you know, your like, skills with like, basic stuff, like, I know. Sure. Like, people usually don't use trees, but I think recursive functions are are important thing that people should know. All right. Yeah. Yeah. So it's, that's the main part like you got to be study those algorithms for like BFS or DFS. And yeah, that's, that's pretty much it. Some other feedback? I guess. So I know, you you asked me while you were coding, oh, can the the numbers be negative? Oh, what is the maximum length? I think you should really do that at the beginning. Right? Because like, I personally think like, if you're just like jumping in, and then you realize this in the middle, that this time is easy, right? You can you can, you know, stick an absolute value on your if statement, and I can solve it, you can like change your millions, one, and that's fine. But if it's some other constraints, that is, like more complicated, it might change your entire code, and like what you wrote might not even be valid. So you really gotta gotta, you know, clarify those constraints early, before you jump into it. Oh. And last thing, I think you mentioned in the middle, you were you were saying like, oh, something about like copy pasting. It's like the same. But like, it's like embarrassed like one for even this is for the odd case. So then we just like, you know, switch around the comparison signs. I think it, I don't think you have to technically do it. But in my opinion, it's very, it shows you're very, like versatile. And you're like a good coder. If you make like a helper function, and you like wrap both. So like, for example, if you have like, check even or odd function, right, and you and you wrap line 65 to 79, right. And then you pass in a little flag. That's like true or false. And, and then you just use the same code, basically. But then in one case, it would go into like one of these in the other case, it goes the other way. Now, you're technically writing less code, right? So yeah, so like, more readable thing? Yeah, it's Yeah, it's like more readable and like you said, like, if I like use yourself said I don't like when people copy and paste word, right. So clearly, there's some shared functions in here. Now you can like essentially reuse like at least the for loop, you know, like line 17, like that shared between both of them. Both of them are, you know, for looping through the list or whatever, and so, always tried to think of like how, like, try to reduce the amount of code you're writing essentially. Yeah. And yeah. Otherwise, I think you had a good grasp on the modularity part. So that was good. Good logic on the figuring out what is previous and updating that and being able to check larger, smaller. And yeah, besides that, overall good. I think the only real big lagging thing is the tree making it into the array part. Alright. Sartorial Jaguar: Yeah, yeah. Okay, so my question about that question is, so that is just knowledge I didn't have right knowledge I have not exercised. Yeah. And I be fulfilled, too. So this is that's the biggest fault of this whole interview. So that's what I have to work on. However, how I'm not like they could the question on the interview could not be recursion, how can I make sure that no matter what that question is, like, do I just keep doing leetcode challenges? Mighty Hamburger: I mean, yeah, practice makes perfect. But wait, what do you mean, they could have been recursive? Sartorial Jaguar: So let's say after this interview, I go and I master recursion. And then I get into the next interview, and they asked me a question about a different concept that I come across the same issue I came across in this interview, how can I be sure to cover all of those bases? Mighty Hamburger: I mean, I think that you just got to practice a lot of a lot of problems. Well, yeah, that's that's obviously the tricky part. When you when you say it can't be recursive, I don't I don't know if you learned it in school. But if you do like BFS or DFS, you can do both of those. Either iteratively or recursively. So like, like when you said oh shoot and it isn't a recursive? Technically you can. Is this a little bit harder to write out. Sartorial Jaguar: Yeah. So what I meant when I said that is... Yeah, I know, you have to examine all possible solutions. So I hadn't examined that possibility. I just went gung ho on the recursion. Mighty Hamburger: And actually, yeah, yeah, that is, that is one. Oh, yeah. I forgot to mention that. Yeah. Don't like, you know, be gung ho. Like, if you explain your process, like, the interviewer might be able to help you guide, like, oh, you're on the right track. Have you thought of doing it a different way? Like, you know, they can give you like pseudo hands, right. But if you if you just charge in and start coding, then then the interviewer was like, Oh, I guess he knows and stuff then starts critiquing you, you know, like, yeah, yeah, okay. Yeah. All right. Cool, then. I guess we got five more minutes. Do you have any other questions or anything you want to ask me otherwise? Sartorial Jaguar: What do you... What's your situation? Like? So I, I have, what, almost two years of work and then school before that. Mighty Hamburger: Okay. I'm probably a bit older than you. I graduated from college in 2017. So I have four years of experience in the industry. Sartorial Jaguar: Yeah. Okay, cool. Are you currently hiring right now? Mighty Hamburger: Am I currently hiring? Sartorial Jaguar: Like, I'm wondering what? What the What? What do you think about? Mighty Hamburger: I was like, is my company hiring? Oh, no, no. Company is sorry. I am wondering, you know, changing jobs, maybe. So that's why I was practicing on here. Sartorial Jaguar: That's what that's what I was trying to ask. Mighty Hamburger: Yeah. Yeah, yeah. Yeah. I think I might change jobs. So I was like, Oh, I gotta practice. So I've been doing a lot of leetcode. And then I just signed up for this interviewing.io thing. So besides leetcode and this, have you read the book, Cracking the Coding Interview? Sartorial Jaguar: Cracking the Coding Interview? Mighty Hamburger: I have, yeah, I can. I can, I can send you like, I think you can google like a PDF. It's called this Cracking the Coding interview, it's a book written by this, this person who was like at Google event, and she, she did a lot of interviewing of other people. So the book is really big. So it covers like, basically all the concepts that you need to know. And like, I know you'll probably look at and be like, Oh my god, there's so much stuff to learn. But, like, if you can do everything in there, like these interviews will be like a breeze. Basically. Sartorial Jaguar: So okay, yeah, cuz that was my next question is I have to I'm finding a difficulty finding practice questions relevant to my, what I'm interviewing for an embedded software position. And all of these are just kind of general I think they will be heavy on like our toss stuff in right now that I see. Mighty Hamburger: I see. Yeah, interviewing.io is more general type of question. So I'm not sure they can help you as much with like, embedded systems and stuff. Like, there. There might be like a few questions in the book. There might be like half a chapter in there on that, but I'm yeah, I don't know. Sartorial Jaguar: Okay, I'll have a look at the book. Mighty Hamburger: Yeah. Okay, cool. Good luck then. Sartorial Jaguar: Likewise.
Want to get some practice yourself?
Become awesome at interviewing, and get actionable feedback from engineers at top companies – it’s 100% anonymous!