Coding Blocks - Algorithms, Puzzles and the Technical Interview

Episode Date: April 19, 2015

On this episode we discuss algorithms, puzzles and how to approach them when asked to solve one in the interview process. We discuss many of the problems programmers face when being asked to solve the...se types of problems as well as steps to alleviate some of these common issues. We also provide a number of resources for sharpening your problem solving skills as well as a number of resources, and of course our favorite tips!

Transcript
Discussion (0)
Starting point is 00:00:00 You're listening to Coding Blocks, episode 26. Subscribe to us and leave us a review on iTunes, Stitcher, and more using your favorite podcast app. And visit us at CodingBlocks.net where you can find show notes, examples, discussion, and more. Send your feedback, questions, and rants to comments at CodingBlocks.net. Follow us on Twitter at CodingBlocks or head to www.CodingBlocks.net and find all our social links at the top of the page. With that, I'm Alan Underwood. And welcome to Coding Blocks. Itingblocks.net and find all our social links at the top of the page. With that, I'm Alan Underwood. And welcome to Cutting Blocks.
Starting point is 00:00:28 I'm Joe Zach. And I'm Michael Outlaw. Yeah, that's good. All right. Awesome. So starting off with a little bit of news here, I have a bunch of things we want to mention to you, but we'll get through them quickly.
Starting point is 00:00:44 First of all, our pal Andy Joyer pointed us towards a swansea con and not sure if i'm saying that right but it's actually uh it's an agile development software craftsmanship conference in swansea south wales september 7th and 8th and they've got some really cool talks like architecture versus code and treat your code like a crime scene. And my favorite one refactoring mountain doom. So when they say like treat your code like a crime scene, does that mean they just point blame? Yeah.
Starting point is 00:01:14 Place blame everywhere. I just imagine like Dexter going around with his little strings and this is your fault. Get blame. Dexter. Wow. You took it to a dark spot It does sound like a really cool conference
Starting point is 00:01:27 So if you're in that area of the world Or if you want to send me there You probably know if he pronounced it correct That's right And also I wanted to give a big thanks To Tom Dane And he works for a company called Ansarata And we wanted to give them props
Starting point is 00:01:41 You've got a keeper Ansarata So you should send him to SwanseaCon Yes Alright also we got a ton of reviews Which you know we've said Before thank you very much Some of them Craig Oliver Nightbob3 Kevin
Starting point is 00:01:57 Salonan Techiesuck Tom Dane and BrooksNet And Techies Suck Tom Dane and Brooks Net and Techies UK oh I was surprised you said that I was like
Starting point is 00:02:12 wait wait what Techies UK or Techies Suck whatever so so thank you we'll figure something out yeah so thank you
Starting point is 00:02:23 I'm just glad it wasn't me this time so yes thank you something now yeah so thank you glad it wasn't me this time so yes thank you uh very very much appreciate the uh the kind words that you guys left for us both in itunes stitcher and and you guys have also emailed us directly so thank you thank you very much yep and we've been really bad about responding so thanks for your patience uh we do appreciate it we've got a faq uh question answer coming up uh sometime soon yeah i feel like it's safe for me to blame you guys for the bad responses since i've already publicly said that you know i'm horrible at the responses
Starting point is 00:02:54 yeah fair enough i've been trying to get back to them as soon as i can i think i replied to several right before the show although if you did get a response and it was for me it'd be interesting to see if who could figure out they got the response From me Yeah that'd be interesting nobody will You don't think anyone will figure it out I don't know let's just say that there were some From me
Starting point is 00:03:15 In other news I actually did get A two part video up on JavaScript closures so if you Want to know what Well so you know what's frustrating wasn't enough, well, so you know, what's frustrating about that until I gave away all my life's information and sold my soul to YouTube, I couldn't do anything longer than 15 minutes. This was right at 16. So I had to break it up into two. I no longer have that problem because I did sell my soul to YouTube. So the
Starting point is 00:03:41 next video, if it does run over 15 minutes, you'll be fine. But there is a two part course on that or not course, I guess, just kind of like a learning thing. So if you want to know why you need a JavaScript closure and what it actually is, go check out the videos. We'll have links in the show notes, or you can just go up to the site and at the top of the page, there's a YouTube link, click that and go over there. Yep. And I actually watched the videos. I can, videos. I will testify that they are very good and did a good job of explaining what closures are and gave a really good example of why
Starting point is 00:04:12 you would use one. Yeah, I liked it too. I watched it too. Cool. Appreciate that. So that's two of your watches. Yes. I think we've got like 20. That's a tenth of them. Nice. Also, we have a bunch of people who ask all the time how do i sharpen my skills at programming and there is a fantastic resource out there called topcode.com
Starting point is 00:04:33 and if you go there and sign up for an account you can actually compete writing code and if your code wins you can earn money so it's actually kind of a good way to get into this because we always say the biggest challenge is coming up with something to do right and so they're like going to secretly use your algorithm to like you know create skynet but they needed like this one little part of the puzzle they couldn't figure out probably um but it's it's a really cool idea case all my strings there it is so so if you've been looking for for a way to do some code on the side to sharpen your skills a little bit better this is a great way to do it you may not win any of the contests but at least you'll learn something along the way so definitely go check that out www.topcode.com yeah that sounds like it'd go
Starting point is 00:05:22 very well with today's episode. It will. That actually reminds me, I wanted to mention real quick, I don't know if you guys heard, I heard about it on the Security Now podcast, but the guy who won like $275,000. Oh my God, that guy was sick. Wow, yeah, it was like 2,000 lines of code, something like that.
Starting point is 00:05:41 From the Black Hat, it was 2,000 lines of code, Black Hat, they gave away, I want to say it was over $ hundred thousand dollars worth of cash and prizes that was given out for different bugs that were found one guy took over two hundred thousand i don't remember the exact number but he took over he took more than half of the total prize given out and it was for like bugs that he found in or exploits i should i should phrase it right that he found in chrome and ie and firefox and uh safari so yeah he he uh it was and it was i remember i don't know where all of them it was just one of okay i remember what it was it was the chrome one that was two thousand lines of code and it took advantage of um chrome's native uh javas Yeah, the Knackle.
Starting point is 00:06:26 Yeah, so that's a pretty nice hobby. So yeah, I was able to sell my wife on spending some more time with my nose in computers. Like, hey, babe, look at this. There's potential. Yeah, if you bring home 200K in one competition, she might let you stay there a lot longer. That's right. Yeah.
Starting point is 00:06:43 All right, so I kind of have a confession here. Right? So. Is this appropriate? Well, we'll find out. Let's just take it by ear. This is Michael, by the way. I know some people can't tell us apart.
Starting point is 00:06:57 So yeah. Yeah. That's kind of your Michael. I thought I was Michael. It's a double edged sword. Weird. I'm Bill Clinton. Wow. This confession really is going to get dark.
Starting point is 00:07:10 So there I was. All right. Lots of editing coming. So, I mean, we've talked about before with, you know, ReSharper, for example, and my love affair with re sharper, but I've uninstalled it. I've done it before. So I've actually been running without it for quite a while now.
Starting point is 00:07:38 So like what happened was, um, I wanted to use the power, the,'s it called the visual studio power tools power tools yep and um but there's a known uh conflict between power tools and um resharper so initially like when i had the two installed, it was creating some problems. So what ended up happening was uninstall one and play around with it and see if it got any better and then ended up uninstalling the other one. And now I have neither, and I've just been running like that for a while. And what do you miss the most?
Starting point is 00:08:24 My dignity. running like that for a while and uh what do you miss the most my dignity um no uh there's definitely like in um like i don't know all kinds of little cool things like finding references i like the way that resharper does it versus the built-in way that um uh visual studio has it but you know i don't know there's it's there i like the the refactoring capabilities better of resharper than what's there so it's like it's a bunch of little things that like there's some functionality that's already there inside a studio but i kind of liked resharpers spin on that functionality better does that make sense yep so the code cleanup it's not like yeah i mean that's part of the refactoring there's not like there's one big thing you know i i also
Starting point is 00:09:11 missed like the little um i don't know what they call it but you know the the stoplight you know the the or the i should call them like the little hash marks with you know red green yellow yeah you know for those kind of things you know i miss that and the squiggly suggestions all the time. But, eh. Is it killing you or do you feel like things are running faster or better or anything? So when I originally set out to do this, I thought, well, you know what? I was really on the hook to go ahead and upgrade to version nine. And then, uh, I thought, you
Starting point is 00:09:51 know what, I'll go ahead and uninstall and, um, just to, you know, work without it for a little while. And then when I decide that I want it, then I'll go ahead and do the upgrade. Right. And there've been a couple of times where I've been tempted to do it, but, um, where I've been tempted to go ahead and do the upgrade, but like nothing that I've missed enough that I'm like, yeah, okay,
Starting point is 00:10:17 fine. Let me do it. Right. Um, I mean, I'll, I will, I know I will go back to it.
Starting point is 00:10:22 There's no question in my mind about that, but, um, it, um, it's just, there was some comment like on like the last episode, I think it was too, that made me want to, uh, say something about it too.
Starting point is 00:10:34 And I can't remember what it was, but yeah, I'll definitely be back. Yeah. I spent a couple of days without recently cause I kind of switched versions of visual studio and, it was painful for me cause I'm so used to just being able to kind of type. And I guess I've just gotten used to the patterns. I do use the resharper Studio, and it was painful for me, because I'm so used to just being able to kind of type, and I guess I've just gotten used to the patterns.
Starting point is 00:10:47 I do use the ReSharper shortcuts, so it was painful, but the thing that I kind of missed the most was just being able to type a class name that is either in one of the references or maybe in another project that I haven't added to using for, and it's just really good about finding stuff like that, and it's also good about finding things that you haven't actually built yet so if you create
Starting point is 00:11:06 a new class and then hop over somewhere else you may not have compiled yet but you'll still get the the autocomplete for it right part of it too has just been like where have I been coding to so I've been spending a lot of my time more on like
Starting point is 00:11:22 front end code where ReSharper provided less I mean if you're doing a lot of my time more on like front end code where uh resharper provided less like i mean if you're doing a lot of heavy c sharp then it's uh definitely more valuable i pause it sometimes if i'm getting too aggravated i can't deal with it like all right i don't want anything else slowing down anything else that i'm doing yeah maybe that's why i showed up all right i kind of got my feelings hurt a little bit by that why sure how i feel i don't know i kind of take it personally a little bit my confession wasn't wasn't juicy enough for you no i it was too juicy
Starting point is 00:11:55 i kind of feel a little sad like maybe there's gonna come a day with roslyn and just improvements in visual studio maybe i don't need resharper. And I, I think I might just kind of buy it because, because of what it used to mean to me. Well, I will say that like in, in the, in the spirit of features missed,
Starting point is 00:12:16 right? Um, one feature, and this isn't a, a resharper feature, but a visual studio feature. I really wish they would open up code lens more actually i think this is in the 2015 uh preview if i remember right or is it maybe i know it was only an ultimate in the previous so they kind of they combined like pro and ultimate
Starting point is 00:12:36 yeah because in it was in uh in in previous versions it was only in the ultimate version like you just said yeah it was one of them, too. No, it was Ultimate. Ultimate, yeah. It came in Ultimate. And it was awesome. And at first, I thought, like, man, I won't grow attached to that. And then I did. And then when I went away from the Ultimate versions, then, yeah, now I feel lost.
Starting point is 00:12:59 I'm like, oh, I love that. Yeah. It's pretty. All right. I'm trying to see if it is in the 2015. I'm bringing that up now. So do you guys have any progress updates on our New Year's resolutions? I was already feeling a little depressed. Not going to kick me when I'm down.
Starting point is 00:13:17 We're a quarter of the way through this year now. It is in the 2015 preview. The CZP. I have very minimal progress. So I've done a little bit more stuff on my Roguelike, which has nothing to do with functional, but it has been UI focused. So maybe someday I'll sell it on Steam.
Starting point is 00:13:34 I don't want to talk about it. All right, so Outlaw's out. So I don't really have much progress on the Angular project. You made some videos. I did make some videos for the for the youtube stuff so that's part of it um but the angular thing with 2.0 coming out it kind of frustrates me right like i don't want to do any videos on 1.3 so i started looking at 2.0 well 2.0 was built on typescript you know and i've been kind of like naysaying on typescript forever like people like
Starting point is 00:14:02 oh you should check it out i'm out like whatever you know why do i want a language that just writes my other language for me man that's every javascript framework out there but man i gotta tell you like i spent some time messing with javascript or with a typescript over the weekend it's pretty sweet and and here's what i'll say about it even if you have no interest in doing TypeScript whatsoever as far as how you're going to code your JavaScript it is worth going over there and looking at their handbook and doing some of their samples and then running their TypeScript compiler to write your JavaScript so they can so you can see how they're doing some of this stuff because basically what it's doing is giving you like ECMA 6 type features with the new, with the latest TypeScript, but it's backward compatible with the other browsers. And so you'll
Starting point is 00:14:51 get to see how they're doing these funky closures and, and constructors and interfaces and all this kind of stuff. So it's, it's pretty powerful stuff. I mean, like being a C sharp developer or a Java developer, you would feel very comfortable writing TypeScript and not feeling like your soul was being sucked out of you for being a JavaScript monkey. Yeah, I mean, I feel like my progress report doesn't have much to report on because I've spent more time focusing on the things
Starting point is 00:15:20 that actually matter to my day-to-day job and life rather than just learning Ruby for the hell of it. I think at this point, I was actually thinking about this this weekend that I was like, well, I need to go ahead and just devote some time to it. But I was like, well, rather than maybe going deep into it like I originally had envisioned,
Starting point is 00:15:37 maybe I'll just start out with a very surface level and just so I can at least have some exposure to it. Codecademy, dude. Just run through Ruby that way and it feels so easy. It's worth trying. Yeah. So that's it for the progress report. It doesn't come up in my day-to-day.
Starting point is 00:15:57 That's the problem. Yeah, no, I get it too. It's the hard thing about learning another language. If you don't have some sort of project in mind, it's hard to force yourself to do it. If only there were some like kind of trivial projects that you could do that would help you kind of learn something with a focus yeah i could come up with some of those there so so that that brings us to our topic for this uh episode um oh a segue i see what you did there yeah i didn't do it very well though there's a big fat um in the middle which we now can't edit out because then this won't make sense and uh you didn't write
Starting point is 00:16:29 in there like paul blart uh but uh yeah this this uh episode we want to talk about uh puzzles and algorithms and design patterns and what you actually do at your day job so um we wanted to kind of talk a little bit about what each of those things mean so we can kind of give you some context and then uh we'll uh make some points about it hopefully and uh and we'll call it a night yep so i think it's probably important first is what is an algorithm and and a lot of people hear that word and and I think it's almost like mystical to some people. All it is, this is a definition, a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer. Algorithm is just a solution, not the implementation.
Starting point is 00:17:19 Yeah, and it's a precise solution, which I think is very important. So it's like a recipe. Yeah. If you're making a cake or something, you add one cup of this and then you put it you know mix the egg and then you put it in the oven for 350 and it's specific and if you follow those instructions like you should come out with the same result which i'm not a cook so that never happens but uh we wanted to kind of differentiate that between a program. So if an algorithm is a set of instructions that are, you know, not code, it's just a, you know, I want to say English, but it could be any language. It's just a recipe.
Starting point is 00:17:56 Then a program is an instance of that recipe. It's the actual meal that comes out. So it's the actual lines of code, the instructions for the machine to actually solve that problem. If you do it through programming. Yes. And also I want to mention too is along with that program, there's a lot of other stuff that's not necessarily even related to the algorithm. So if you are, you know, trying to sort some numbers, if you're using some sort of program that's going to be useful to anyone in the world, then there's going to be logging. There's going to be arguments.
Starting point is 00:18:29 There's going to be input and output type things. And there's going to be a lot of stuff that is not really directly related to the solving of that problem that is required to make this thing useful. But that's why your one line hello world has all those other lines right yeah if you ever uh if you uh decompile that hello world you're gonna see a whole lot of other stuff going on so then what else is there yeah so if we talked about we said the algorithm is the recipe and the program is like the actual implementation of that recipe along with your other stuff and um i wanted to kind of contrast that with everything else so um things like are we talking about like everything
Starting point is 00:19:10 else in your day-to-day work uh yeah i mean like everything else that um you have to do before you can really say something's done and ship it out the door okay all right so things like uh user interface right all right i to have a user interface. I'm going to ship it out the door. All right. What color the buttons are. Okay. Then there.
Starting point is 00:19:30 I think we skipped one. Yeah, I did. I was going to come back to it. Oh, okay. We'll come back to that. So I'll put a slash there in the show notes. All right. There is also the operations, which is like if this product is going to be shipped, if
Starting point is 00:19:42 it's going to be, you know, like an actual like physical media, like a CD-ROM, if it's going to be in actual physical media like a CD-ROM, if it's going to be deployed somewhere. Oh, that kind of operations. I thought we were talking about like an order of operations kind of thing, like the actual instructions that are being done. Oh, no. Sorry. So you're talking about like operations as in facility operations. Business operations.
Starting point is 00:19:59 Where is this thing actually running? What's it doing? How do I update it? And these things are often forgotten. How do I get this to the people that are paying me for it? You totally went out of the programmer world then. Yeah, absolutely. But to kind of bring it in, there's a lot of debugging.
Starting point is 00:20:14 Well, wait a minute. What if it's already right? If you run something the first time and it works like you expected it to, then you're in trouble. No, the first time you run it, your tests fail because you're in trouble uh no the first time you run it your tests fail you're doing tdd no one does tdd oh really but it's a thing nobody got time for that no the only td code that's ever been written in the world was for tdd books or videos or videos and also just the other kind of stuff that goes on in your day-to-day life like
Starting point is 00:20:45 meetings with people um code organization and those meetings are always good and valuable yes absolutely the longer the better and then of course my favorite part of the day uh lunch well that's that's where most of the work happens right but uh there's one other kind of thing that i want to mention there. So we talked about algorithms. They're the recipe. The program is the implementation. Then what are design patterns? Let's see.
Starting point is 00:21:15 That won't be a good one. I feel like you already got an answer at the ready and anything to come back with you're going to trump. I don't know that I necessarily have an answer. It's just making it better right like everything you do it's just making your code better more reusable more i was gonna say it's a repeatable pattern maintainable right yeah yeah it's almost a way of like organizing your program right but it's got this weird relationship with a but it's almost like a pattern. A design pattern is,
Starting point is 00:21:46 does follow like your definition. You know, I was joking about the definition that, uh, Alan read off for algorithm, but, uh, you know,
Starting point is 00:21:54 it almost feels like it fits a lot of that. Yeah. And so I process your set of rules to be followed, right? Yeah. But it's definitely got a lot of kind of carry over there, but, um,
Starting point is 00:22:03 yeah, I don't think you can really call any specific design pattern an algorithm. Like these are things that you might do. They might be part of your program, but they aren't really specific instructions for doing anything. Really, design patterns, as I think of them, are like a kind of a collection of, you know, objects that do certain things and have methods. But they're not necessarily like, um, what's it called? Like a workflow.
Starting point is 00:22:26 What's that called? Uh, it's got the triangles and the squares and circles. Yeah. I think it's a workflow diagram. Getting closer, getting closer. Uh,
Starting point is 00:22:38 we fit. I don't know. I have no idea. Oh my gosh. This is going to come to me like tomorrow night. No, but I mean, that's all it is really,
Starting point is 00:22:49 is design patterns as a way to make your code easier to maintain over time. Flow chart. Flow chart, there we go. Yeah, so yeah, to me, you know, an algorithm is a flow chart. And a design pattern is almost more like an architecture. Okay. So, yeah. Hmm.
Starting point is 00:23:04 I don't know. I feel like maybe we could argue that one. But. I don't know. I feel like maybe we could argue that one. But we don't have to. Oh, we can. Whatever. I mean, it really feels like the design pattern is really close to the algorithm definition. I feel like, you know, to me. It's not a solution.
Starting point is 00:23:19 But it's not an implementation. It's not the implementation. It's a process or a set of rules on how to do something. I get that, but it's to me. It's like here's the rules for a singleton. Here's the process for, you know, I've got to bring up my boy. Right. So here's the process or the rules to create a singleton. And they don't, you know, I mean, in some, you know, depending on what you're reading,
Starting point is 00:23:42 they might give you actual implementation examples. But I really feel like design patterns falls under that algorithm definition. But what I don't like about it is it's not really specific steps to solve a particular problem. I think an algorithm would be like getting ready in the morning, brush my teeth, take a shower, get dressed. But the design patterns are solving particular problems, though i i think of them as part of a solution yeah but you don't actually solve anything but your program the algorithm there are multiple algorithms in your program and each one of those algorithms are solving a part of the overall program uh sure one algorithm is how to take input one out one algorithm is how to take input One algorithm is how to output
Starting point is 00:24:27 That's not really an algorithm though An algorithm as I see it is you have a problem It was the first time that somebody had to figure out how to do it Well yeah agreed But now it's just read line right Or something like that An algorithm is literally If you think of it
Starting point is 00:24:41 Taking input is not an algorithm When you say that you want to get – But that's why I was saying like we're taking things for granted, though. Maybe. But okay, fine. Go on. That one's a tough one. But either which way.
Starting point is 00:24:56 So like an algorithm is, you know, you need to do X, Y, and Z. How do you get there, right? How do you get from A to Z? So – and I get what you're saying with the design patterns, and I don't necessarily disagree with either one of you on that one that i'll tell you what this is going to be the question we tweet out and you dear listener we want to hear from you what's your take do you think that the design pattern falls into the definition of algorithm as alan read out or do you think it is something else other than an algorithm i think that's more than 140 questions the characters no that's the question they can
Starting point is 00:25:32 answer it however they want all right we're gonna we're gonna hone that sentence down we could put it we could make the question an image there you go and uh we actually got some um there's some kind of famous examples of uh oh you know we didn't we didn't actually talk about puzzles at all but uh so what's the difference between a puzzle and an algorithm then when i think of puzzles i you know i think of someone asking for an algorithm so you say here's a problem give me a solution for it and that algorithm represents a solution so you're creating the algorithm to solve the puzzle i never think of that when i think of puzzles what do you think of for puzzles i think that either uh you know i think that the person asking the question about the puzzle is just trying to gauge the receiver's
Starting point is 00:26:27 uh response how do they react to particular situations so they don't actually want a solution they just want to see if you're um they want to see your solution sure they want to see your thought process they want to see how you think under pressure and and you know how you work with it. But I don't know that – I guess where I'm thinking though is that I don't know that the correctness is always – I'm not saying that being wrong in the interview would be acceptable. But I'm saying like I don't know that's always what they're looking for. They're not necessarily always looking for an absolute correct answer well let's come back to this after in a minute
Starting point is 00:27:10 because we're going to get into a whole set of things and there's a lot of truth to what you're saying right now but but that's actually something that we've got most truth not all truth just a lot not all truth a lot of truth um but we'll come back to that because we definitely have a whole section dedicated to this whole idea of doing um coding during an interview process and what it means and kind of how it fits so so okay well then during your day job what are you going to be doing so i mean honestly as a programmer really what you do during the day is you are solving problems all the time, right? You're designing algorithms and writing programs. That is what you're doing.
Starting point is 00:27:49 Right? And sweating. What? Okay. I was trying to set you up, but you didn't take it. I think real hard. You didn't take it. Instead, you went somewhere else with it.
Starting point is 00:28:01 I made a funny... I feel uncomfortable. Yeah, I'm really amazed by how little time is spent on a keyboard. How much actual time is spent isn't typing. It's everything but. So conversations, figuring out what you're going to do, reading so much, reading of code. It's not exactly what I thought of when I was kind of in school.
Starting point is 00:28:26 When I was in college, I was thinking, I'm going to be designing algorithms, and I'm going to be writing programs, and that's not really what I do so much. Yeah, you do spend a lot of time in the research area of it, or not just researching how you're going to solve the problem, but researching what's already there to see what you're not going to try and you know break or step on or all those pictures are research and research is such a polite term for uh the really the frustrating morass of like
Starting point is 00:28:56 what the hell is going on there are definitely times where you're like really seriously this is ridiculous this is impossible this is oh oh okay i see so hey let's talk about some of the famous ones that we've one of them we've definitely brought up before on here and that's called fizz buzz oh my god right yeah this is like interview question number one like you should learn how to do this just because you're going to be asked like 10 times in your life how to do this yeah and i mean and again we'll come back to the how you solve these type things in a little while but but these these puzzles these famous ones here they're not necessarily made to find out if you're the best programmer on the planet but they want to see how you logically think through a problem right a one that just came up on Hacker News the other day that Joe pointed out to me, and I had to go read the article, was why do most programmers fail at this one simple problem? And the problem was
Starting point is 00:29:58 this. You need to be able to print out the numbers 100 all the way down to one the caveat is the very first line of your code excluding any usings or anything like that just imagine all that stuff's already there but the very first line is for i equals zero so i go from 100 down to one by start with i equals zero yep so you need to print out yeah yeah you need to print out 100 well if it's javascript you say var i equals zero then that's me yeah nobody's got time for that i actually did it in javascript but at any rate so so that's that's the key so they want to see how you think and and it was amazing so we're definitely leaving a link in the show notes because this was an entertaining and eye opening article was it basically the guy was
Starting point is 00:30:45 measuring hey so when i give this problem out the first thing that they did is they asked people hey you know what what kind of problems did you have at your last position and what they found is you know some people would complain and whine about it and then then later on they would follow up with this with this i equals zero question and then they plotted, or this guy plotted, hey, the people that were able to do this problem were they typically the ones whining or was it the people that were failing
Starting point is 00:31:14 at this problem that were the whining? And there was a direct correlation between the people who could figure out the problem and the people who whined about it. Yeah, I may because one of the first things they asked was like what you thought about like what were some of the problems you had with your previous job and how long they they whined about their you know problems at their previous job yeah part of that input yeah the plot was amazing so it
Starting point is 00:31:35 it's just really interesting to see these kind of things and really if you think about it and he said you know i wanted to see how many people can figure this thing out in under two minutes it's a fairly simple question and and a lot of people would get it wrong and then they would correct them and then they and then they get it some people would sit there for over 10 minutes and not ever come up with a solution so it was a really interesting thing but again this is a thing you actually had some people walk out too yeah i mean it's killer but and we've all experienced this right like we've all experienced this, right? Like we've worked with people or, or done interviews where you're like, I don't know where else to go with this.
Starting point is 00:32:12 Right. So. Yeah. It's easy to get stuck sometimes. I mean, these aren't the kinds of things that you can, that you do in a normal job, right? Um, you know, fizz buzz a hundred down to one, like this really isn't a good model for what a day-to-day life of a programmer looks like but it does show that you know how to program and how to solve problems so i you know there is
Starting point is 00:32:32 some tie over but it's it's just kind of funny to me to think that like you can go in and say you do a interview with facebook or somebody and you do these really cool puzzles and you're solving cool binary tree you know recursive whatever and then you get to work and you're, you know, working on the contact us form for three weeks. Yeah. And that's a reality. I mean, that really is. There's actually a joke about this, though, too, just recently. I'm trying to remember where I saw it now.
Starting point is 00:32:57 It was on, like, maybe Reddit or someplace. Stack Exchange, where it was talking about a question just like that, where it was like, you're interviewing for some top job, and they're asking you super secret or super difficult NASA-level space questions. And then you get in there, and it was like, hey, our About Us page, we need you to make the font three pixels larger and move it to the left. But you have to go through our crazy CSS system, content management system, whatever. Yeah, CMS, yes.
Starting point is 00:33:30 Yes. And there was one other one that was a really cool puzzle, or not puzzle, this was like solving an algorithm. It was on a Pluralsight video that we'll leave a link in the show notes. But it was title casing. And this is a perfect example of the kind of problem that you would get in an interview process because there's a bunch of steps that you have to go through. You're given this sentence and now you need to spit it back out in the proper title case.
Starting point is 00:33:54 And we're going to go through kind of the steps that you would take to solve this in just a minute and kind of give you some insight into what an interviewer is really looking for. And I know that if I were looking to interview right now, I would definitely buff up on doing these kinds of puzzles because there's a good chance that you're going to get asked, and it really does help to practice. Yeah, it does, and there's no substitution for practicing this stuff. Like you cannot prepare for this just by sitting there thinking, oh, I'm a good programmer, right?
Starting point is 00:34:23 You need to polish up on it what if you're really good there are you all right this episode is sponsored by infragistics we want you to go over and check out Infragistics.com slash what's dash new. They've got a ton of stuff going on right now. They've basically just revamped a lot of their products and their site. And they're now giving a webinar series on a number of topics
Starting point is 00:34:56 from migrating from the desktop to the web, going beyond responsive design. They have a thing on prototyping and managing change. So basically doing fast prototypes without actually having to go in and write any code so that you can see what's going to work they have storyboards and that kind of stuff and they have another webinar on on checklists for moving from the desktop to the web the kind of things that you need to be aware of when you're doing this
Starting point is 00:35:19 so one of the cool things right now is you can just go up to Infragistics.com itself, and there is a registration link there on the front page, and they are holding these seminars, and it appears that they are completely free on the 23rd of April, the 30th of April, and the 7th of May. And it looks like some pretty killer resources. And, of course, they're probably going to tell you how to use their tools while doing this. Yeah, it's just really powerful tools and frameworks. And you can sign up for a free trial along with the webinars.
Starting point is 00:35:49 Yep. So definitely go check that out. Again, it's www.infragistics.com. And register, sign up for the webinars, and see if their tools work out for you. All right. And so with that, if you haven't already left us a review, we would greatly, greatly appreciate it. You can go to www.codingbox.net slash review and either go to Stitcher or iTunes, your choice of index. And please leave us a review. We greatly appreciate it. It does help us out.
Starting point is 00:36:21 And, you know, if you already have left us a review, thank you. Thank you. Thank you. And, you know, spread the word. Tell a co-worker or two or three, you know if you already have left us a review thank you thank you thank you uh and you know spread the word tell a co-worker or two or three you know yeah and those reviews really bump us up in the ranking so uh if we ever want to take out cereal you know we need those reviews yeah reaching for the stars that should be a tip for the week if you haven't listened to cereal yet let's do it so good i agree so if you are frustrated with us if you are frustrated with us because we don't give you a podcast per day or week go listen to cereal in between and you will thank us because it is truly amazing stuff it's like 12 hours of like wow. So why should you practice puzzles?
Starting point is 00:37:07 Practicing for the job interview I think is the big deal. But also say if one of your New Year's resolutions was to learn Ruby, then maybe this isn't a bad way to go about it. Oh my God. That is actually a very good point. Taking this as a jab at me. This is a whole podcast way to jab at me. So you should go to Project Euler.
Starting point is 00:37:24 Open up your Ruby script. Yeah, and we'll actually have a list of links to really cool puzzle sites in the show notes, and Project Euler is one of them. But yeah, I do think these puzzles are a great way to learn a new language. As we mentioned earlier, it's like a short, focused little problem that you can kind of spend 15 minutes on that really will kind of give you a good overview of most languages. You know, you're going to be looping, you're going to be printing the screen, you're going to be doing the basics and, you know, functions.
Starting point is 00:37:49 And so it's just a, it's a good way of learning a new language. Yep. And it's fun. Just kidding. It's kind of, it's kind of fun. It is a little bit fun. If you're watching TV at the same time, it's all right. It can be a little bit fun just because you're challenging yourself, right?
Starting point is 00:38:04 I mean, that's, that's really what it boils down to. I actually do think it's a lot of fun. All right. So now getting into what I said that we were punting on earlier, and this is the whole part of the job interview thing where Michael was saying that basically it's not always that they want you to get the absolute right answer because some of these things can't necessarily be solved while you're sitting there completely from from start to finish or or they might be extremely difficult to do so a lot of times what what people want to see when you are in an interview room and they're telling you to write code on a board or on a sheet of paper or type it into a computer
Starting point is 00:38:40 they want to see how you think and they want to see how you take input. Like if, if you're getting frustrated with something and they try to offer input and you bark back at them, then they're going to be like, Oh, this guy's probably not that easy to work with. Right? Like there's a lot of things that they're looking for. And one of them is what is your thought process? And, and so that kind of gets into this, how, how do you solve a puzzle? Right? So how do you solve, or how do you create an algorithm? Like the title case thing that we had earlier, right? Like if the very first thing you start doing is writing code, you're probably going to start coding yourself into a corner and get frustrated because now instead of having this
Starting point is 00:39:21 clear recipe, as Joe put it earlier, instead of having this recipe that you can look at and make sure that you have things in place, now you're going to be trying to rearrange code and you don't even know where you're going with it completely yet. And you're going to keep running in these edge cases. And so it becomes very difficult. So there's a book that we'll include as one of the resources in the show notes, but it's called Cracking the Coding Interview. I'm not sure how to pronounce her middle name, but Gail McDowell is her name.
Starting point is 00:39:55 She actually had... She's been an interviewer at some of the big companies. I think pretty much all of them. Google, Facebook, Amazon, Apple, IBM. I mean, she, she had quite the, uh, you know, all the big names on her, her resume as a, um, you know, hiring manager or, you know, interviewer, uh, at these companies. And,
Starting point is 00:40:22 um, one of the things that I remember that she had said too was that like when it comes to the how to solve the puzzle, when you're giving these problems, like number one thing you should be doing is start writing down the requirements. Yes. Let that, let that be number one,
Starting point is 00:40:37 understand them fully. Yeah. Because this gives you an opportunity to make sure that you understood and interpreted the requirements correctly from the interviewer yeah there's nothing worse than trying to like fix your algorithm that's like totally wrong and what happens is like you end up with a couple for loops on the board next thing you know you're like kind of moving variables around and you're totally solving the wrong problem and it's hard to kind of morph that to the right answer
Starting point is 00:41:00 and copying and pasting on a whiteboard just is more difficult yeah there's no undo well i mean take you back to grade school stuff you remember like there would be those problems that it was literally designed to make sure that you were reading the problem completely right like you the very like maybe the second sentence was just write five for the answer and if you didn't read everything perfectly question any test i got like that i just made me mad and but that's what i'm saying so that's it's so important because as the interviewer the person who is actually giving it to you they want to make sure that you actually are thorough right like you're going
Starting point is 00:41:35 through you're taking down the requirements exactly as stated just like read all the questions first oh yeah yes and then the last one was just write your name. Yep. Yep. And that's, so that's kind of the whole thing, right? Like it may be, they don't even want you to write an algorithm. They just want you to read and,
Starting point is 00:41:50 or do something. So, so make sure you pay attention. Um, but so that's, that's the first part, right? Why do they want to see you code?
Starting point is 00:41:59 They definitely want to see you code. They do. They want to see, they want to see how you think and, and what your process is and, and like what kind of code you might throw out there so so let's go through the process of what you should probably do in this situation if somebody gives it to you so like the title case thing like i said came from the plural site video um so you have this you have this this set of
Starting point is 00:42:21 requirements right you get this sentence you have to uppercase the first and the last word. And then there's certain words like a of the, and maybe some other ones that are always lowercase, right? The first thing you need to do is you need to write down those requirements. Don't write any code, write the rules. First word, always cap, last word, always cap last word, always cap. Um, you know, a, the, and of always lowercase, every other word, uppercase. All right. So that's your list of requirements that you have right there. Then, so you've put those all down. Now you basically want to try and, and like, maybe take a sample, write down a sentence, take a sample and then step through it with the logic that you had and see, see what steps you had to do to recreate that.
Starting point is 00:43:11 Yeah, that's really important. You want to make sure that your answer is correct. You know, you want to be able to solve the problem, um, you know, by hand before you go off and do the wrong thing.
Starting point is 00:43:20 And this is so, so this is how you know if TDD is real. Do you do your your interview puzzles tdd the unit test first and then go back and write the code and if you're being really strict they do the whole thing we're like just write the minimum amount of code to make the test pass yeah that's that's rough um yeah but all your whiteboards are taken up with unit test yeah and you haven't even written the first bit of code. Yeah, that would be really funny. I've never seen someone do that in an interview,
Starting point is 00:43:47 but just start writing a test first. I always test first. Assert. That would be awesome. So, yeah, I would say get a couple of sentences. In this case, if it was this example, you'd take a couple of sentences, write it down, and do it all kinds of funky, right?
Starting point is 00:44:02 Like maybe you have the D with a capital T, a capital H, and a lowercase E. And then you might have and with a lowercase a a capital n and the lowercase d and do just kind of funky things that you wouldn't you know you wouldn't know what to expect when you got that input now you got to convert it right and so then you would hear like a funky bass line every time you say funky so so then the next thing you would do is after you've kind of figured out where you're trying to get to, you've defined those steps. Now you want to pseudocode that right in pseudocode doesn't mean start writing your vars and your ints and all that kind of stuff. It says, okay, I'm going to loop through this here. I'm going to do this here.
Starting point is 00:44:42 I'm going to do this here. Right? So it's just, it's generally the, the programming steps that you would think in your mind to do that. Then what you're going to do is you're actually going to step through there and now replace your pseudocode with real code. And so, so let's do this one. So you get this sentence in what, what are you going to do in order to be able to do this? You're going to capitalize the first word, the last word, and then you're going to, um, any, this list of things like a of the, and those are always lowercase. And then all the other words are upper. So what would you guys do? Can you repeat the question?
Starting point is 00:45:21 All right, Joe's out. So, so you get this sentence in, what are you going to do with it now catalyze the first and last and then uh but you have a sentence what have you got to do to be able to even get these into words right right you got to tokenize it somehow okay so how are you going to do that um what was it uh split there we go yeah if i'm working in javascript yeah it's a split even in c sharp i really solve this like right now i don't know that's a good point what kind of hung me up is like i started thinking about like going through and kind of like doing like a stack to you know do the words because that'd be most efficient like
Starting point is 00:46:00 don't worry about that stuff it's hard not to but if you can just concentrate on getting a simple solution that works first then you can always take it and improve it from there but focusing on getting it done first is a good idea we'll see and that's kind of why in so saying solving this on the air um the only reason i'm saying it is because this is the same kind of thing that you'd be facing when you sit down right so and granted it's a little bit more difficult we don't have anything to write anything out with right here we're just kind of going on the fly and i already kind of have in my head how this would work because i'm kind of the one who came up with this one uh as far as watching the video and all that but if this was a real interview i wouldn't have had pudding
Starting point is 00:46:35 ice cream and a cookie beforehand that's a good point i think joe's a little carved out well yeah i don't know i i was thinking like, as you were talking about this kind of problem, I was thinking like, well, I wonder what kind of, you know, the maximum length of the input coming into this might be because that could very easily, like you could take a simple approach of just say, hey, you know what? Let me be lazy. I'll just uppercase everything just to be lazy i'll uppercut i'll just upperclass or uppercase everything just to be lazy and then i'll come back through and look for these specific instances and lowercase them and then you know
Starting point is 00:47:11 maybe deal with someone for the the first and last you know since since you wanted that but that's a you know a really gross lazy way to do it no but but not necessarily right if it's short input then to joe's point point about just putting together something fast and then iterate over it later, then, you know, maybe that'll get you there. Yeah, so, I mean, that's kind of... But if you're going to bring in, like,
Starting point is 00:47:32 you know, here's War and Peace, now, you know, title case... It's a title, right? So you would have to assume some sort of length, right? I mean, it wouldn't go crazy. You're not talking about throwing a novel into this thing.
Starting point is 00:47:44 But, so, it's interesting. So, exactly said you would split you would split the words right so you get your array um and this is kind of the the thought process that you would go through is you would say all right now at position zero the first word let's uppercase it position i see this is where i actually had a different approach on this too but um off the top of my head i don't know that the the um ascii equivalent but i was thinking like hey what if you did do the split like joe was suggesting but then you took an int pointer for the first character of each word and then just added uh the difference which is yeah right which is like i don't know something like 30 or something i don't remember what it is yeah I don't know. Something like 30 or something. I don't remember what it is.
Starting point is 00:48:25 Yeah, I don't remember. I was like, oh, that'd be a neat approach. That might be pretty fast, too. You could probably just do one quick. Say if this value is less than whatever the int value of lowercase c is, right? If it's between this range, right? Then you could just add in the difference and that would uppercase it yeah you could you could also find that difference if you just took the
Starting point is 00:48:51 car of a capital a in a car of a lowercase a and then subtracted the two and found it yeah in ascii but by the way these are all things that these are conversations you're not going to have an interview yeah yeah you don't want to do that practice system no you don't want to be talking about i don't even know that i agree with the whole practicing thing though like for specifically for the interviews i mean don't don't you're not gonna the chances of you practicing a question that's going to come up on an interview it's got nothing to do with the question it's got to do with the practice so really what you're practicing is the steps writing it down getting the steps yeah giving test inputs outputs but where i'm going with that though is that like just a little while ago we were talking
Starting point is 00:49:24 about like well why should you practice these problems? And one of the things that was said was practice for a job interview. And I was kind of like, I mean, I didn't say anything at the time, but I was kind of thinking, I don't know that there's any value in practicing that for an interview. Because the chances of you getting a question that you practice, there's no value in that. Then why? Because let's say, hold on, hear me out. Before you go further, though.
Starting point is 00:49:42 Let's say that you do get, let's say that you happen to luck up in a question that you practiced. Let's say Fizzbuzz, that you practiced, was asked of you. Well, if you just randomly throw up an answer real quick, then they're going to know, like, oh, wait a minute, he already knew that one. No, but here, I'll take this back to the resource. And you're not taking the chance to practice writing the interaction with the interviewer and writing out the requirements. You recommended cracking the coding interview.
Starting point is 00:50:14 Why even do it? So, per what you're saying, though, I disagree. I think everything comes with practice. You don't ever get better at something by not practicing. Do you think that you're going to get better at something by not practicing do you think that you're going to get the same exact problem no probably not and you i to your point yeah if you just went in there you're like oh i got this right you throw it up on the board they're gonna
Starting point is 00:50:33 be like oh well that was easy we still got 45 minutes left well that's actually a scenario that she points out in the book though is that like if someone um you know obviously already knew this particular question maybe because it was one that they happened to practice. Or maybe they just got it at a previous interview. Right. Or in the scenario that you provide, maybe somebody told them, hey, this question gets asked. That was one of the tells that she looked for. That was that if you went through it too quick if you didn't start interacting with the interviewer about the question and you just immediately started you know
Starting point is 00:51:10 to know it then they knew like okay he already knows this one we need to move on yeah i don't think you're practicing to get better at fizzbuzz though you're practicing to solve problems quickly yes like somewhat tricky problems yeah and and again i think it's more about it's almost like when you do a math problem when you're in school. You're not just doing the math problem because you know that that's going to be on the test because you don't know it's going to be on the test. When you do long division, you're doing it because you need to get better at doing it. And it's the same thing with this process. It's really about the process of, okay, let me break down the steps.
Starting point is 00:51:42 Now let me put it in pseudocode. Let me put it in real codeocode. Let me put it in real code and then let me go back and refine, right? That's, that's the step that we didn't get to a second ago was, okay, after you went through and coded this thing. So let's say, let's say that we went throughout the Joe started with where he said, okay, I got this sentence. I'm going to split that into strings, right? Now I need to go through and step through and do these replacements where I do the uppercase on the first, the last, whatever. Okay. After you look at that, then you might go back and say, oh man, what if I just lowercase the entire sentence before I tokenized it? And then there
Starting point is 00:52:14 are certain things that I would never have to uppercase, right? So there are things that you could look at in ways to do that. So really it's about the process. It's not about, oh man, I hope I get this problem when I go in there. It's about about, oh man, I hope I get this problem when I go in there. It's about, okay, this, this is, this is going to allow me to breathe easily, right? Like when I go and sit down in this interview, if I'm used to taking these steps and breaking them down into little pieces that are digestible, then I can go through and step through it. At that point, you have a comfort level and you've, and you've learned how to problem solve in a way that's not going to back you into a corner.
Starting point is 00:52:47 I can't tell you how many people I've seen in an interview where they had to write code on the board where the first thing they do is start writing code. And five minutes in, they're like, oh, that's not going to work. And then they're erasing stuff and trying to move things everywhere. And it's like we said, you can't copy and paste on a board. You can't cut and paste. So literally, they're up there just wiping off the board and that and now they're frustrated because they lost their line of thought because they can't even see it anymore and and they get they get panicky downward spiral it is and it's it's almost frustrating to watch because as a person
Starting point is 00:53:19 interviewing you you kind of want to help them out you've been like yeah that's not gonna work dude but you kind of got to give them some rope right and it's that's one of the things why i say like if you take it back a step and you say let me let me break this down into pieces that i can then recreate i think that's the value of actually going and doing it on your own well if you were going to take my ascii approach let me first say that uppercase A is a lower ASCII value than lowercase a. Ah. 65 versus 97. So I looked that up.
Starting point is 00:53:54 So yeah. So it'd be 32 would be the number. So you'd be subtracting. I'm just imagining like an interview where like you go in there and they ask you this problem and you're like okay first do you mind if I google for the ASCII values of A well no you can just do what Alan suggested just take the car but it was bugging me I was like what is the
Starting point is 00:54:14 value yeah it does you know like one thing that you know I guess a lot of the a lot of the show notes here that we put together were more in the mindset of like why you as an interviewee might the question wrong that doesn't necessarily mean that you should uh you know dismiss dismiss them automatically right i mean like you know because you know that's a stressful situation for anyone so uh you know don't don't just automatically
Starting point is 00:55:04 dismiss them just because of that. There's more to take into consideration. And their thought process and, you know, the direction they were going, that's, you know, valuable. And like Alan said, too, you know, I mean, sometimes you might need to help the candidate along, you know, just to ease their comfort level. I mean, I'm not saying you got to give them the answer, but, but them getting the answer right or wrong, isn't necessarily what you should be gauging. Yeah. You're trying to see a thought process.
Starting point is 00:55:39 And like I said, also the interaction, right? Like, like you want to judge something because it is a stressful situation for a lot of people you want to see how they react to the pressure right like it and and a lot of the better interviews that i've been involved with or seen or or or taken part of typically if somebody gets hung up they'll be like what the way that the interviewer will approach or should approach is, Hey, I see that you've got this and I see where you're going. Maybe you should just, you know, think about moving this over here. Right. And maybe spark something in the person. And then that way they're like, Oh, Oh, okay. I got it. Right. And, and again, it's the whole reaction,
Starting point is 00:56:17 the interaction between the people, like it's the whole thing because there are going to be times, like we said, where you sit there for half the day and you're like oh why can't this work right and and maybe all you need is like a co-worker to be like oh well we'll try this out right the symbols flipped the wrong direction oh so it's one of those things to where it's it's a judge of so many things do you are you comfortable with the programming language like i guess one of the scenarios i'm thinking of those if like if it's a trick question right and you know it's a trick question yeah and there's some like obscure way to solve this problem efficiently like really efficiently you know doing some kind of weird you know uh casting the character to it and you know like some kind of weird like you know, uh, casting the character to it.
Starting point is 00:57:08 And you know, like some kind of weird like way to solve the problem. Right. And the interviewee doesn't, you know, maybe come up with that solution and they come up with one that's maybe not as, uh, efficient, but they try like, you know, like I'm saying, like that thought process of to how they how they were going to it could still be couldn't still make them a valuable valuable member of your team and uh you know regardless of whether or not they came up with oh i recognize this specific trick that you're looking for uh let me just add these values up and then subtract out the right mean value blah blah blah or whatever those are the
Starting point is 00:57:46 ones that are frustrated by pie and carry the two so speaking of what he just said if you go on a project euler which is a lot of mathematical type challenges it is so frustrating not being a mathematician because after you so just a little insight and it's worth going up and checking out but like i think the first one's similar to fizz buzz. I don't, I don't remember exactly how it went. It's like you sum the numbers rather than printing. Yeah. So you basically take all multiples of three and all multiples of five below a thousand
Starting point is 00:58:18 and then you have to sum up all those things. All right. And then, and then all it wants is what's, what's the answer at the end. And you can go about it any way you want. You can write loops, you can do whatever. The problem is you get into the form afterwards and you'll see these mathematicians in there that'll have this equation written out where they just plugged in some numbers and they plopped out the thing. And you're like, wait, how am I supposed to know that? And that's one of the things that you run into. A lot of times, if it's math related, there'll be some sort of equation that people, you're just not going to know about.
Starting point is 00:58:50 Yeah, I mean, like, for example, I want to read off this one. Because this is an example of, like, the kind of things that you're talking about where, like, if you're not ready for the math tricks that are out there, this is the kind of question you might get. So, this is the problem that you you might get so this is the the problem that you were talking about from project euler if we list all the natural numbers below 10 that are multiples of three or five we get three five six and nine the sum of these multiples is 23 which is michael jordan's number it's a very good number. Find the sum of all the multiples of three or five below 1,000. Yep. Right?
Starting point is 00:59:30 So that's the kind of thing that you're talking about there. And the thing is, as a programmer, you're probably thinking about doing loops and modulos and that kind of stuff, and that's a very valid approach. Just know that there's some math genius out there who's figured out how to do this using some summation equation. And unless you're aware of it, you're not going to be able to do it that way. Now that is one more important tip that I can give you. If you are in an interview where they ask you a question like this, you look at
Starting point is 01:00:06 all the things that they say. Okay. Like this one, it says multiples of threes and fives. You say, Hey, are there any tips that you can, are there any like magical equations that I should be aware of to make this easier? And the interviewer might say, I'm not aware of any, or they might say, yeah, everything that does this and this then you can apply this equation so it's also an exploratory thing right don't be afraid to ask the interviewer if they give you these things and you're not fully aware of of all the pieces that may happen right like you remember sitting in uh god probably chemistry class a lot of times they would hand you out a cheat sheet because if you didn't know how to do it, you weren't going to get it right with or without the cheat sheet.
Starting point is 01:00:47 You got a cheat sheet in chemistry class? I needed one. But you know, it's one of those things like calculus, algebra, that kind of stuff. There's all these equations out there, right? Like if you looked at it and you didn't know what that little fish symbol on the page was, it didn't matter that they gave you that equation you weren't going to get it right but i also think it's important too to like this is another thing too that kind of bugs me is that like kind of to the joke that we were talking about before though too is like if you're the interviewer you know your questions should be respective of the job that you're trying, I think.
Starting point is 01:01:26 They never seem to be, right? Because don't ask me a mathematical question like this, and then like we joked before about like, hey, I need you to change the font on the About Us page. Right. Or hey, everything needs to be two pixels to the left. Yeah. If you're being hired to do distributed networking systems then maybe
Starting point is 01:01:45 then maybe that's what you should be interviewing but it sometimes it does feel like it's disproportionate right i do remember someone saying once uh that they took a job because of the the questions they were asked i was just like sorry man oh we totally misled you there sledge there. That was just an interview, man. It had nothing to do with the job. It's nothing personal. Yeah. So, again, just revamping quickly. Determine the problem.
Starting point is 01:02:14 Write down the steps. Don't code it. Then pseudo-code the solution. Replace the pseudo-code with actual code, and then go back and refine. See if you can make it simpler easier less steps whatever which one of those can i skip uh if you skip any of these do it at your own peril right and that's the thing like there are some people like i used to love math i or i guess i still do but i used to skip skip steps all the time right if you know that you are good at that
Starting point is 01:02:42 you can do that otherwise i very much recommend that you are good at that, you can do that. Otherwise, I very much recommend that you go through these. No, chances are it's, I was joking when I was asking that, you shouldn't skip either. Chances are high that even if you did, if you were good at it, like I said, some of what they're trying to gauge is your thought process and your interaction. And if you don't even write it out there and you don't take the time to discuss that, they're not going to know what your thought process is. Right.
Starting point is 01:03:08 The interviewer can't read your mind. So if you're not going to like discuss it or write it out, they're not going to know how you got to that. Right. And like I said, they're trying to see your thought process. What would be even better is if you had like done the problem on your phone or
Starting point is 01:03:21 just pull it up the table, like looking like, Hey, give me one second. Yeah yeah i brought a cheat sheet with me can i so so i i feel like uh you know in the in the vein of why you should not practice puzzles i i kind of already you know mentioned my reason for it uh which reason of that is it that there's no real world value no just it's like the the the chances well i was saying don't practice them for for specifically for interviews i mean not if you think that it's going to help you because well when this question comes up i'll be ready for it yeah yeah never ever do it for that reason at that you know do it because you want a fun challenge.
Starting point is 01:04:07 Then that's okay. Because it's cheating, basically. No, because I was saying that the likelihood of it coming up is if you're doing it because you think that I want to be prepared. This isn't like the chemistry test that Alan used the cheat sheet on. This isn't like your school test where you know whatever you studied in that chapter is likely going to be right covered on that test this isn't like that no this is more about honing your skills in in problem solving that's really all you're doing
Starting point is 01:04:36 oh there are websites out there for uh practice problems for google interviews oh that's funny people actually will write up the ones that they've gotten and so maybe you can go out there and learn well vince vong got a job there that's right he did yeah yeah so but all he had to do was just give him a video yeah that's a good point yes also uh speaking of google um they recently kind of came out and said they were getting away from these kind of puzzly type problems because it's not a great indicator of job performance well i thought the ones that they were getting away from were like the weird questions like um if you were a window washer in san francisco how much would you charge to wash each window and why like those kind of questions and how many windows are there
Starting point is 01:05:22 on a city block or something like how many golf balls could fit in a school bus Like I thought those were the kind of questions they were getting away from That's what I understood too Yeah, they're still doing the coding challenges It wasn't the programming questions It was just the random how do you think type things How many pickup trucks are there in Illinois Yeah, those kind of questions
Starting point is 01:05:40 They got rid of those 15 because that's how many people No, just kidding Oh, that's a bummer So my dreams of BSing my way through a google interview are crumbling yeah apparently unless you happen to get with this phone and make a video then but uh another reason not to uh practice puzzles is a that uh there might be and this is arguable um more effective things to uh to improve on so i would argue argue that since most of your time spent working is not writing programs for
Starting point is 01:06:10 algorithms, that you could probably do yourself more good by learning more about code organization and naming and solving real life business problems. Git problems, for example. Those kinds of things would probably save you more time day to day than uh you know doing project euler although project euler is awesome but there's some truth to that well i mean like you know the example that you guys teased me about earlier about for learning a new language then yeah sure you know i mean if that's if that's a way you want to learn a new language then sure i think that'd be a fun way to do it. Yeah. So that kind of brings us to the next question though.
Starting point is 01:06:46 The last question, which is what do you guys think is the best, most time effective thing you can do to improve your, you know, day-to-day programming life? Topcode.com. Did you make some, make some money?
Starting point is 01:06:59 You make some money while you're trying. I don't know. I, like I'm, I'm a sports driven person and part of it is because i like competition right there's a goal like when i was sitting down to learn something like ruby if i didn't have some end goal in mind it was literally just staring at the computer like okay what am i gonna do right but if you have something like top code where you're competing
Starting point is 01:07:26 to get some money and there's actually a reason to do it other than hey i just want to learn how to do this then i don't know it kind of gives some extra drive right it even even with self projects you know i mean joe's probably the only one here who's done like a huge project on the side literally on the side with uh um oh my god no color mine it's not that big um but no i mean it's a pretty massive site like i've gone through and looked at it it is hard to make yourself buckle down and do that kind of stuff right because it's it's a it's a pet project and so having something like top code makes a lot of sense to me or project Euler. I'll tell you one of the things that I found that I really liked about it was that three
Starting point is 01:08:09 plus five thing. So after you get done, they open up a link to a forum where you can see all the answers that everybody else has done, which is both frustrating and rewarding to a certain degree, because like the way I went about it, I was skipping, you know, like I wasn't looping from one to a thousand because I didn't need all those numbers, but it was interesting. The number of people that literally just did, Hey, I equal I plus one. And you know, they looped all of them. And then there was the flip side of it where you had these mathematicians out there that basically had one line with, you know, four plug in equation things, and then they were done. So you can kind of, you can see how different people solve these things. And it's kind of nice
Starting point is 01:08:49 because it opens up your mind to thinking about the next problem. Hey, how could I solve this a little bit differently? Right? So, and what I like about puzzles is, um, you know, with side projects, they can be open-ended, you know, most of them never get finished. Most of them don't even get started, but the puzzle, you can spend 20 minutes and you get the right answer and you get a little you know you get a little uh hit of dopamine or whatever and you feel good and you learn something and you've got something to show for it yeah it's like playing around a call of duty you're in and you're out you're done you have a finish line oh god no it's it's much more of a time suck than that but yeah it it, there's a finite,
Starting point is 01:09:25 you can see the light at the end of the tunnel with them, which is kind of cool. Yep. And did I mention I'm level two on Project Guler? Yeah, that's ridiculous. That means he has solved 50 of these things. Yep. And that was before they lost their database.
Starting point is 01:09:38 He can't prove that though. Oh, actually, I do have a link, and the name is shared with a bunch of my other names on social media so i can kind of prove it but yeah they lost their database and what that means is um it was their user database so people weren't able to log in and because they never asked for your email there was no way to verify that you were whatever account name so what you could do if they did allow you to kind of claim accounts is you can go look at the leaderboard and say, hey, that guy solved 500 problems. Yeah, that's me. Reset my password.
Starting point is 01:10:09 And they had no way of verifying because they had no email addresses on file. So everyone who did Project Euler problems, or most people who did them, were locked out of their accounts. And that's why they replaced the very first Project Euler question with architectural questions.
Starting point is 01:10:27 Oh, right. How often should you back up your database? Yep. Hourly? Daily? Weekly? Yeah, and that's one of those things. You can spend a lot more time with problems like database backups.
Starting point is 01:10:44 But the good news is that i do have all these solutions um to all my problems so i can go back through and kind of plug them in but uh not a big deal that's organization i definitely would not have those yeah that's resume what are you talking about um one of the things that he's got here is what is the best, most effective thing you can do to improve your craft? And we've hit on this in several of these, but we got reading. We've got what? You already asked that.
Starting point is 01:11:16 Huh? You actually kind of answered it. Somebody wasn't paying attention. Oh, I said top code didn't I But we didn't say reading We didn't say plural sign Oh yeah I just kind of threw that in there I mean the question was there
Starting point is 01:11:34 But yeah we didn't Nobody answered any of them Well my answer is actually to just do everything So you should read you should watch videos You should do a side project Because you get a kind of different perspective from each of the things. There is no silver bullet, you know, in my opinion. So, you know, doing puzzles isn't going to get you everything you need
Starting point is 01:11:50 and neither is watching portal site videos. That doesn't mean that I dislike either one. It's just that you need a broader perspective. Yeah, I'd agree with that. This podcast. Oh, definitely. That should have been first. Man, how did you miss that one?
Starting point is 01:12:03 The best thing you can do for learning programming Is to leave us a review Yes that will definitely help you out In this world of learning Alright Alright so The resources that we talked about And that we like are topcoder.com
Starting point is 01:12:20 We mentioned Yeah a couple times What is this Rosalind.info slash problems dash or slash list that is not the the rosalind that we're used to thinking of this is rosalind it's just got a really nice collection of problems that you can do to kind of learn new stuff it's much less mathy than project euler oh that's better um code golf code golf dot stack exchange yes so like in golf um masters going on uh not too far from here actually the masters are done oh okay well it's finished but uh actually a 21 year
Starting point is 01:12:56 old just smoked it yeah wow yeah well second youngest the goal the goal is to basically solve problems in as few lines as possible. And there's some really clever problems and solutions. Very cool. Project Euler, we said. Google Code Jam is one. And Cracking the Coding Interview by Gail McDowell. We'll have links to all of these in the show notes. So let's get into the tip of the week.
Starting point is 01:13:29 All right. of these in the show notes so let's get into the tip of the week all right so so since joe mentioned that you know uh working on learning things that'll solve your real life you know day-to-day business problems and specifically called out get i have a get tip of the week for you. So assuming you use command line like every Git user should, Git has tab completion in their commands. So, for example, let's say you want to check out a branch and you maybe don't remember what the whole thing is or maybe it's a long branch name, you don't want to type the whole thing, you could say git checkout start typing the branch name,
Starting point is 01:14:12 tab tab, and then git will suggest all the branches that start with that portion of the branch name you've already typed in. Just like tab completion works everywhere else that you've ever used. How do they do that? It's awesome. It's got to be built into Bash or Cinchment or something like that. I don't know. just like tab completion works everywhere else that you've ever used how do they do that it's
Starting point is 01:14:25 awesome it's gotta be built into bash or cinch with their app i don't know it's not running git but you know just by hitting tab right yeah no it's it's a bash thing i would say it's pretty cool though all right no it's a good thing because if you do it it's got to be on a good thing because if you do it on uh on checkouts you could do it you could do it on files too because if you do it on, uh, on checkouts, you could do it. You could do it on files too. Like if you wanted to add or, uh, maybe if you wanted to do a checkout reset on a file, or if you wanted to do it on, um, um, like if you wanted to add a file to your, to your staged commits, or if you wanted to remove it, you could do it there too. And it'll, it'll show you the suggestions and it'll do it based on here,
Starting point is 01:15:08 not just the files that are on your directory system, but here are the ones that are modified that you might want to consider like staging for a commit. That's pretty cool. Yeah, that is awesome. All right. If it's on the bash level and not in Git level,
Starting point is 01:15:23 then mind blown. No, that makes sense. It's part of the git program like some sort of git bash integration i don't know yeah it's cool so mine i'm cheating uh well now you're making me question because i do use git bash yeah i'm not certain we i'd have to try it in something else that wasn't git bash to see but i mean like everything like git bash or even connie mu i use get bash inside of that no no so like if you use terminal on mac or something that's that's what i'm getting at oh yeah i can do that right now yeah i was about to say like you're welcome i have a terminal command right here there you go uh so mine's a little bit of a cheat uh mike barlow wrote in and he like like ourselves, we've mentioned many times that we listen to our podcast sped up.
Starting point is 01:16:09 Mike does it at two speed. I do mine at like 1.8. I don't know if Joe does anything different. One five. Speed for the win. One five. So that's one of the great things about YouTube recently and being that I just uploaded a YouTube video. This is very near and dear to my heart.
Starting point is 01:16:24 You can speed up YouTube videos. Um, if you're using the HTML five player, like in Chrome, then you can go in and set it on 1.5 speed, 1.75. And it's awesome. Well, he pointed out that there is a little shortcoming in that not everything allows you to do that. Like if you go to Vimeo, you can't speed those up. So he found this plugin for Chrome that is called Video Speed Controller, and it's in the Chrome web store. We'll have a link on the show notes for this. But if you're using the HTML5 video player and the video can be played in that, then you can speed up the control of that video using this plugin. And that's kind of cool. So you could speed up video
Starting point is 01:17:06 all over the interwebs. And I find this extremely helpful, especially for you learning videos, like, like the one that I put together, like, I don't want to sit there and listen to listen to it for 15 minutes. But I definitely would like to speed through it. And if there's a part that I want to go back and listen to that, I might slow it down and back it up and do it again. But you know, for the most part, I'm just cruising through this stuff. So, uh, really nice tip. I appreciate that, Mike. Uh, thanks for sending it in and, uh, thanks for letting me cheat. And, and, you know, you mentioned it, like I listened to probably, I don't know, we'll say like at least 10 hours of audio, you know, talking per week.
Starting point is 01:17:41 And, uh, I'm so I've gotten so used to it being faster now when I watch movies and tv shows sometimes i'm like getting really impatient like even if i like the show like come on daredevil what about game of thrones there's no way that you want that sped up uh too slow oh come on there's not enough dragons just you know come on north come on dragons let's get to it i think we need to get george r R. Martin to finish the series then, if that's what you're looking for. Yeah. All right. Finally, my tip, Andy Joyner sent us this.
Starting point is 01:18:11 It was a pretty cool tip. So basically using a transaction rollback if you're working in SQL to kind of try out queries before they actually happen. So what that means is you basically kind of begin the transaction, do some stuff, and then make sure that you run that rollback if you're not actually ready to do it yet. Now to kind of flush out problems and see what's going to happen without making any permanent changes. So it's definitely a scary tactic, you know, because you don't want something to actually break or you have a typo in your rollback or something that doesn't happen. But if you're doing one of those things where you like tried it on dev five times and now you're ready to do it and you want like one more thing to kind of make sure and uh it's a pretty cool uh trick it is an
Starting point is 01:18:48 awesome trick i will forewarn you though depending on what tables you're doing that on you actually lock other tables from doing any queries yeah that's a good point i mean you definitely are you know you are playing playing with fire you are so be careful about that and one other thing i will caution you with there if you're doing a small set fine if you're doing like thousands and thousands of rows it can take a long time to run that update or whatever it is maybe that you're running that rollback is going to take equally as long if not longer so yeah i'm kind of wondering like any dbas listening I wonder if any DBAs listening to the show now are like, no, no, no devs in the database. Yeah, yeah, yeah.
Starting point is 01:19:27 So it is an awesome tip. I definitely use it myself. But just be forewarned that this is not your first line that you want to try. Man, I feel lied to. It didn't work on my terminal. Yeah, I think it's a Git Bash. Git solve that. Wow.
Starting point is 01:19:48 Yeah, baby. Dang. So I guess inside of Git Bash, then they have it smart enough. Because like on my Mac here, I checked out a cloned color mine. And if I start modifying some of the files, and then I do like a Git add, and then tab, tab, it just shows me all the files and then i do like a get uh add and then tab tab it just shows me all the files and if i start to type any one it just automatically picks one so you're saying get bash for the win then yeah i think you might have sold me on get bash no no but actually no hold on let's take it a step further go ahead and install get bash then install connie moo and then just run
Starting point is 01:20:22 get bash as a new tab inside yeah but. But that's what I was saying. That's what I meant before when I said though, that even if you were doing it inside of Connie Moo, it's still like, that's why, that's why I didn't put the two and two together. Cause I've kind of, that's probably another confession I should make that,
Starting point is 01:20:38 you know, I've converted over to Connie Moo. Oh, you did. Welcome to the club. So now, see, now I gave out a big head. I already don't't like this i already had a big i take it back i i am you love it don't you come on forever fan you love it don't you so well you know don't don't well no this is a good well because here's
Starting point is 01:21:01 here's what here's what uh finally convinced me on it you know because i was i was a strong believer in just using git bash just because uh less is more kind of scenario right like why do i want to install you know i want to install as little as possible um you know i want my system to be as clean as possible and that means installing as little as possible to get the job done i agree with that and you, if I was already going to install Git Bash, then I don't want to have to install other terminals as well or other shells as well. Right. But on a, you know, you talked about some DPI issues with if you're using, for example, like a Mac Retina, a MacBook pro with a retina display, and then, you know, going between, uh, you know, monitor sizes, especially if you're using that in bootcamp, then it normal
Starting point is 01:21:55 by default windows, uh, eight dot one, at least in my experience on a MacBook Pro with a retina display, if you were to bring up something like Git Bash or PowerShell or Command Prompt, the font sizes were so incredibly small. It's like one pixel. It was like written for ants to read. And I don't mean like your family member. I mean like – But Connie Mew, though, on the other hand really handled that situation well and it didn't matter and um i think like back when we did the episode on you know
Starting point is 01:22:34 our favorite tools um i think one of the things that you had referenced then at that time was that you could unlike powershell or compare command prompt you could, unlike PowerShell or Command Prompt, you could just resize it to any size that you wanted to and it just, you know, the window, it acted like any other kind of window should. Yep. Whereas, like, if you wanted to have more width on, like, PowerShell or Command Prompt,
Starting point is 01:23:00 you had to go right-click on the properties, change the layout, you know, 9, 9, 9, 9, 9. change the layout you know nine nine nine nine nine and then you know then you could have some more width on it right and with connie mu like it just acts like a normal window it's so great so i kind of got converted on it but so on my mac though going back to the git thing is that if i if i say you know i modify multiple files on here sorry joe i'm gonna put in a pull request for this. Dash F. Just push it.
Starting point is 01:23:36 And if I do one where there's multiple files that have similar names, it's definitely just showing me all the files that begin with that, whereas on Git Bash, it was smart enough to show, like, here's the ones that have actually changed. Unless maybe I just had some dumb luck. You had some really good copy. Man, now I just feel like I'm taking back my whole tip of the week. I'm good. It's a non-tip of the week.
Starting point is 01:24:06 Git Bash, that's the tip of the week. Yes, Git Bash was the tip of the week. I uh i'm good it's a non-tip of the week get bash that's the tip of the week yes get bash was this tip of the week i thought it was calling you okay oh there you go well no no both of these you need them yes of the weekend different times but together together they are pure joy tab tab tab key is our tip of the week yes all right so let's pull requests real quick all right so uh with that like we've said before if you're listening to us for the first time someone loans you uh uh their phone or mp3 player and uh you know you're not already subscribed to us go to codingblocks.net and you find out more information you can subscribe to us on itunes stitcher and more using your favorite podcast app and be sure to leave leave us a review on iTunes or Stitcher if you haven't already.
Starting point is 01:24:48 We greatly appreciate it. Yep, and contact us. We've gotten a lot of questions and topics here recently. We love those. We are actually stashing them away, and we are going to be going through them. Like we said, we're going to be doing a Q&A session. We're going to send them to each other as Christmas cards. Yeah, there we go.
Starting point is 01:25:07 Thinking ahead for next year's New Year resolutions. So, yeah, definitely do. Send us any questions, topics, leave your name, any preferred method of shout-out you have. And, yeah, that's it. Visit www.codingblocks.net where you can find our show notes, examples, discussions, and more. And send your feedback, rants, and questions to comments at codingblocks.net where you can find our show notes examples discussions and more and send your feedback rants and questions to comments at coding blocks.net and uh follow us on twitter
Starting point is 01:25:29 at coding blocks we also have this thing called facebook nobody uses that yeah we have a mailing list too we do have a mailing hey yeah come come sign up on our mailing list we email you about once a year Actually hold on We've done what two or three this year Yeah maybe If we get more people on the mailing list We're no mathematicians So counting
Starting point is 01:25:56 This is all a for loop So yeah Come up to Cody Blocks Sign up for our newsletter And the whole goal is we're going to send out like some of this cool stuff over time so um that is it and i've almost got this title choosing program done are you doing are you working on it right oh come on man

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.