Skip to main content

Coding Questions

Lesson 13 from: Creating an Effective Developer Interview Process

Gayle Laakmann McDowell

buy this class

$00

$00
Sale Ends Soon!

starting under

$13/month*

Unlock this classplus 2200+ more >

Lesson Info

13. Coding Questions

Lesson Info

Coding Questions

So we talk about what to look for in cans are coating. So first of all, the reason why we ask this we asked cans actually code and not just think about provinces. They're your heart encoder. So you want to know that they can actually code? And as much as I would love to believe that you if somebody can, you know, has been a coder there therefore at least recently competent it code that's not, unfortunately, the reality. So you do want to actually test to see if they can code? Because what I see is that some people, either they can code but with terrible quality on it's very indicative in the style and other things. But the other thing is that not everybody can actually really translate out into coat. So sometimes people can come up the great algorithm, but translating that, getting the details of code they struggle with sometimes so some things that go around here One is interviewers who require every little detail. You know, ultimately, you you should be walking away with its not Did ...

they write this code completely correctly upon a whiteboard? But have I gotten a good signal about their coding skills. So, for example, um, question, I ask people, uh, you have a Let's see, you have a list of states in each. Each state has certain of electoral toe kind. Election problem. Each state has a list has a number of electoral college votes. Basically, the question is, given this list of states, can you find a What's the smallest subset of states or smallest member states? Accounted has to win in order to get exactly a tie. Now, when exactly half the college, if somebody can do all the rest of the stuff. And you know one thing you don't have to do is you have to actually get the sum of all the states in the subway and then get half of it to figure out. Can you reach this tie? I don't someone can do. Although this stuff I don't really need to see them do this for loop That walk soon computes of some right. Like if they don't know that, that's just not I'm not getting extra data by seeing them do that. Uh, if I'm asking somebody to sign our them Teoh, remove or find a random note from a binary search tree. I don't need them to write out this class node with a left note and right? No, just because that would make it more complete. I'm not looking at completeness. I'm not looking correctness and of itself. But what it tells me about the person. I don't learn that much by having the right this class out. Let me just have him write the stuff that actually matters so realistically stuff. What actually matters. What is giving a better data. If those stuff that can started right that isn't giving you good data, that's just kind of wasting time. Don't have them write it. Tedious questions. So a lot of times like string manipulation problems are just really, really, really painful. I was asked as a candidate to years ago to write code to serializing a, um, external document. It's just a lot of like it's just painful. It's not. It's very an interesting is to have a good problems like Look, I can do this. This is easy. This is not a hard problem for me, but this is tedious. It just gives me the can. The interview wasn't getting great signal from that cause I'm wasting time doing a lot of stuff that isn't all that interesting. And I have a bet. Pretty bad experience. A lot of you being sure your questions are not super tedious. Uh, and if there are tedious ports, maybe you can find a way around that and have the kind of just not right for that part. Um, taking of the testing is now the thing. Sometimes interviewers will dio So what? The candid test. Let them do what they think is useful. So test give them coaching, whatever. That that's fine. But don't take over the testing. So you have. This isn't this problem. Let them try to do it themselves. And then maybe they need help jump in to do that on. Then, as I talk too much times lately, can it code too early? So make sure that when they're coding their coding, what you want them to see and that they feel comfortable for the album start coating. If they start struggling to say, are very focused on getting the code done and they don't really know they're doing, you should be able to pull them back and say, Let's walk through the outcome again, Explain to me again what you're doing. And you can even take kind of personal responsibility saying, Hey, I think I missed some part of the album. Can you walk through it again for me? Okay. Good stuff. Video. You don't waste time have can to do the stuff that matters. Um, hadn't skipped an interesting start stuff. If they don't know some syntax have them. Sometimes Kansas will tell me that they interviewer let them like, Look up, look up, some taxing. Like I look it up, My aunt Just tell the candidate how what this in tax for this or that is our let the make up something reasonable. Uh, I don't If somebody is using a built in link list class, I don't care if they know whether the method is called adder Insert. Pick one. I don't care. I'm not, you know. Yes. It wouldn't compile if you pick the wrong one. The real world, but you're picking Adverse insert doesn't tell me anything about your skills of suffrage. So let people make up reasonable syntax. And that goes as well for people who are coding and languages that may not have the right. You all the same kind of tools. So a C programmer might not have certain things built in. Let's just pretend they have these libraries make their lives easier. It's really if you're willing to consider a C programmer. It's really not fair to put in a disadvantage because it takes them longer to write the code because their language doesn't have these things, built it, let them make things up. Um, and then you encourage testing courage, re factoring, but they can It kind of jump to these themselves but encourage these things and then don't stress too much about compiling. That goes for a swell if you're on the whiteboard. But also, if you're doing you know, things on a coder think Cotopaxi has compiling. I know hacker ranks. Code Patrol does. I don't stress too much. About what? About the code Technically compiles, um because that could be a little bit of distraction. One is, I don't know. You're using adverse and sort That doesn't tell me anything about your skills will suffer. Engineer just tells me if you remember some random, a necessary thing. Uh, but the other thing is that when candid, start stressing about compiling now they're going to spend a bunch of time writing that main function out and writing the whole node class and doing all this other stuff that I'm not learning from. So I'm not concerned about compiling. Even if I have that compilation tool focus on what am I what's gonna help me get the day's best data? Now, this is not does not a silly apply when you're having somebody do, ah, project like pair programming or something like that? This is more you're talking out rhythmic things. Evaluation what you're looking fourth code is seemingly compile. Able. So not, Does all this in tax right but work but doesn't look like it basically works in that language. So, um adverse insert that certainly seem like a viable don't care at all which one you use if it's wrong. What's what I am concerned about is you have a, uh, job. Oh, you're writing in job, Candice writing drama and they right there trying to iterate through all Paris of values in array and they write for a comma, be an array that's night, a syntax error. That's like you don't understand something about Java because you're writing that and jobs like. That's the kind of issue that I am concerned about when somebody is, um, using an array and they pretend that they can just continue to think to shift elements around immediately without, like, doing anything to do it. It's those kind of issues that I'm concerned about, so I want similar compile. Well, I'm not concerned about if it technically compiles or not look at structure and style. I think that's valuable. I think it's valuable toe say to some extent, Did the Cannon Lodge arises? Code look really sloppy, but I wanna put some caution there as well. I had somebody interviewed a little while ago. Who is that? It is an acquisition situation, and I had a conversation that you he was smart, But style was really bad. And, you know, he do things like he was passing in elements into a function and he would just call these call these indices. He passed in like I NJ like all one character things and a lot of other style issue so clearly like a repeated issue. I have a conversation CEO is like, you know, is his his bright Um but it you know, I'm like He reminds me of a college grad again brand new college grad who has never had to the got style guidelines and never really had any looked. Look at his code. I mean, what? I'm surprised he hasn't picked up more during, like, regular code reviews. And this is the company's, like, four years old. He's like, Oh, yeah, I mean, we don't do code reviews here. Well, there you go. He you know, he is four years out of college, but he has never done code reviews. He's never had anybody think about stuff. Uh, you gave the candidates feedback as well. And next day, you know, I told I gave Melissa things like use good variable names. Do. This is in this next day. Never would have known it was an issue. Everything was fixed. Look, like a perfectly great style. Uh, and you know, all you need to know is like, Hey, you got to do this stuff is like, Oh, I never thought about it. Never had any do it. So I do think there's something to be said for the fact that he had never worked environment that had carried about code quality like that you. That means that he maybe has miss certain things. But you will also be aware that overnight he changed. And, you know, maybe someone with bad style just needs a little bit of coaching. Um, with code, I'm not concerned super about completeness or whether code is completely completar incorrect. Their complete whether you all the details and encourage Candace skips details. They don't need to know. Let them test and then focus. Really? On What is What is this telling you about with the candidate? So one, You know, people often hear it said, and they'll talk about bills. Hey, well, why why Didn't have a person, right? If you just want correct, you know, enough compatible enough looking like that. Why don't just do suit ago? And here's the problem. Pseudo code is that it's to me. It's like you're playing a game with secret rules. So you're telling somebody you consume a code, but my sudoku in your suit car might look very, very different, and my understanding of this might look very, very different. So these are all different pieces of pseudo code for a very simple problem. This this is a problem to say um, not hopefully not real interview question, but walk through underway and count the number of rocks. Honore Villagers count the number of values out of between, you know, minute a max range. So these are all different pseudo code. So if you say sucrose, Okay, well, which one are we talking about? Are we talking about this English explanation that really doesn't go to any of the details or you talking this thing that is almost, like real coat and might even could be real code arguably in some language, rather. And so you and you say pseudo code. It just puts us in this weird thing where it's unclear how much is expected if a candidate and if you allow them right pseudo code, they might be writing one when you want the other. The other problem is that it's because we haven't really defined what the rules of syntax are. No, they might say, I'm gonna use a list, and they might just pretend like we can have this list that, um, you know, gets immediately immediately index and get access to the 15th element in this list. But it can also shift elements around immediately and I can also do this this and this and well, But what if it doesn't exist? So these details actually matter? And so the reason I say not so good, it's just unpredictable. It's not clear what the rules are, and I also argue, pushed back the other way. It say that if a candidate finds writing real code too hard and really need pseudo code to make the difference, like that's maybe a bad sign about that kind of it. I I think it just much easier to say to push candidates on saying no real coded this way the rules are defined. It's clear that they have to figure out if it's an array or a link list or stacker que whatever think of the world are defined. And then you afterwards can say, You know what? You wrote this, you wrote. Adverse is insert. I don't care so just easier. If you make the rules to find that you can relax. Uh, okay, you want to thank you again. What's what's the code talking? You know what's really telling you? And look, when you see issues, can it be fixed? They didn't know Binary search trees. They didn't know that. Some of syntax and nothing like that is this, You know, a signal that they don't have the knowledge they should have there. You're in a school and they forgot by near search trees. I'm a little worried. I don't think that something ate some of the year out of school would forget. Uh, somebody with no CS degree hadn't hasn't worked with them. Well, yeah, okay. That's that's not to talk. So think about what kind of issues they have. And can they can they be fixed? So, you know, my arguments, I said, is expect real code, let you relax. Question. What about white boards? Should be using whiteboards or computers. So the argument that people make is again, I'm kind of very aware of anything you dio has its benefits and its trade offs. And those were real. And the trade off with white boards of the kind of harm of white boards set people argues unrealistic. And where I challenge somebody, little there is Okay, It's unrealistic. Why does that matter what? What exactly is the problem with it being unrealistic? I think people make this statement of it being unrealistic with the assumption of unrealistic is bad. We can ever do something unrealistic. Well, look, interviews are inherently unrealistic. So if you really want something realistic, have someone sitting that share on actually work with you for a day. We can't do that for a variety of reasons. Most of you know, one of which being led someone working next you for a day is not also not realistic because you don't know how they're going to perform Three months in interviews are always unrealistic. So the questions Why is that really an issue for white boards to be unrealistic? So the ardent people make and valid arguments is if you give people computer, they it's more realistic situation. You can let them bring their laptop in. Uh, you can you You don't have to have them. If you're gonna be doing that, you don't have to have them right Every detail. That's one issue after C, and you want to do things like encourage communication. One problem I see with White board are when you give cancer. Computer is that their communication shuts down, so you ask him out from the problem. Handles is thinking, and then you gave him a computer. And now all of a sudden they have to take this kind of mental jump from riding out this example in a whiteboard to going from a computer. And it's hard to make that transition back and forth constantly, and they often stop thinking and stop communicating. So you want to know if you're gonna be doing computer using a computer, you want to be aware of these things. You also just want to have a little bit awareness of this issue of bias, where a candidate who has had a lot more access to a better computer and better tools and had someone teach them about compilers r and D buggers is gonna have a better shot a lot of times can. It's in college. Haven't really headed to do debugging, uh, they and they're still debugging with print statements. That doesn't mean that they're bad. It just means they didn't have anybody tell them and say no, we want to do this other thing. Really, developers are great, uh, or something is in a lot of fun and work where you buggers having much hard to set up, so you know, you you want to be aware that one. The problems with throwing some in front of a computer is if you they bring in their own computer, they might have better access to tools and resources and somebody else. If the given give them a computer that you have at the office, then there's this bias of do they? Are they comfort with those tools or not? Uh, soon found signs of computers are people often right. Unnecessary stuff. So my interview, loyal Go gave him gave him a computer, and I kept telling him, like now it's doing interview, coaching and company. Who's about to interview with would give him a computer or so I wanted coach in the same way, and I kept telling him like, I don't write this main function. Don't do this, you don't You do this And he just was very focused on getting it to work and spend much time doing stuff he didn't really need to dio on. And he was very focused on getting it to compile as fast as possible. And he stopped thinking, and so we just contract start to make changes, and I don't really think about what it works, whether or it worked whether that's the right change and you, obviously, that is a problem. The real world. If someone hasn't mentality of let me make arbitrary changes to my code, No, that's that's a bad sign. That's a bad thing happen the real world. But someone doing that interview is that because of how they approach any, every problem? Or is that because they're nervous and very focused on getting this done as fast as possible? Um, so communications. It's down and get this bias issue and then that transition between algorithm and coding this hard people stop thinking and they just have a computer and they don't go back. You know, their examples behind them on the white board, they can't see it. Stop thinking. So you there's has all these downsides. Uh, so best actress you don't waste time, have people, you know, makeup, reasonable syntax, just like you're particularly if you're not, if they don't have like, um, your auto complete type stuff, having make up results in tax, um, courage, testing, re factoring and make it all the same kind of stuff that goes for a whiteboard. Uh, good thing about a whiteboard. Is that the reason why I do like them for interviews is that it encouraged a lot more communication. It's also kind of language agnostic. No, I don't have to worry about. Does my company's computer support this language will or not? It's let's a C coder not be a disadvantage because he doesn't have all these built in stuff, cause I just said You just assume we dio So it's little link diagnostic. It's consistent across candidates. Their access to different tools doesn't matter as much. Uh, and for better or worse, it is somewhat standard Can. It's who are interviewing. They very often are very super comfortable with this. Thing I get is still, you know, whiteboard still make people nervous, but they get it. They got it, Um, so that's that's nice about whiteboards. Downside. Slow to write stuff, especially. And that becomes a even more pronounced issue with more for both languages. Like Job on Objective C. Those are very verbose languages. If cans air righting out hash map string, common energy. My half from P equals new half Thompson commenter. That's gonna be It was going to say it's pretty knowing the right foot backward, so that's that's announce it just takes longer to write. It is artificial, and I question a little bit the challenges, but the mentality of its artificial unrealistic therefore, must inherently be terrible. But you know, it is a little bit of downside because it can make people less comfortable as well can make a little more nervous people. So if you're gonna be doing this morning occurred shorthand. You know, the verbosity is an issue with White board or the slowness to handwrite stuff. That's an issue so mitigate that encourage shorthand more. You want to judge whether somebody uses the good descriptive variables like number of Children. Great judge that. But then, when they're about to write number of Children a second time, say, Hey, it's fine. If you just abbreviate that you let them take shorthand. Do you really need somebody? Do you learn anything by having them actually write out stirring? Probably not. You know, why not just say, Hey, it's OK. You can just say yes, they're so encouraged toward handle but more, and you'll make it a much better environment for everybody and you'll get better data because now they can. You could spend more time on the stuff that matters. Uh, the real encouraging. Be more be really upbeat, read the candidate. Are they seeming to react well to your jumping in and helping? Or are they? Were they before you to take a more passive role? To read that candidate? Often being more interactive can be good, but it can also backfire because you interrupt the can stop process and then sent reason. Electrics Expectations about how much code to write writing even 10 20 lines of code You go up if you haven't interviewed in a while. Haven't done white boarding in a while. This is a good time to start, you know, Go to try it again. Grab somebody you work with and do an interview and experience what it's like to be a candidate in writing code on a white board. It's annoying as TVs, and it's intimidating all this other stuff. So you you want to be very sympathetic to can it's like that. Here's what I had basic say, my recollection. You know, I am very tourney about whiteboards versus computers. I think there's a lot of benefits of each on a lot of trade offs of each. What I'd say is this. If you're giving a candid a problem, that is just not really a thinking problem, really. Just about coding give him a computer because the major downside oven out of a whiteboard is that it's the soft for thinking. But it's really it's really just coating find. Give him a computer. It's much more algorithmic. Then a whiteboard might actually better way of going about it. The other option is you know what? But the candid pick Which one they want. Teoh. Um, actually, what I've seen is that most candid if you give them a choice, will actually, interestingly, pick whiteboards. Um, look the kind of pick, but one puts them, pick them up and give him a heads up About this sort of stuff like this is, if a cancer ever walking in two interviews, being surprised, but having coded whiteboard, that's a problem. So let them let them pick which one they want to do.

Class Materials

Bonus Materials with Purchase

Cracking The Coding Interview Book Excerpt
Bonus Materials with Purchase

Ratings and Reviews

Megan
 

What an awesome opportunity to learn from one of the best on the topic! This course has value for anyone who's looking to hire or work with technical talent! I've attended tons of talent conferences and this course succinctly and tactically address how to effectively interview engineers. Highly recommended.

Kevin Scott
 

Terrific class with unique eye opening content. This class applies for any Dev. hiring team, whether startups or large, established companies. I recommend this training tool to anyone wanting to help others improve their own interviewing skill set and build dynamic hiring processes / plans.

TC
 

Gayle and the guest speakers did a excellent job. My only thought is if we can incorporate more questions from people on chat. Some had good questions but never received the response.

Student Work

RELATED ARTICLES

RELATED ARTICLES