May 16, 2022

Coding Bootcamp Student Attempts FAANG Mock Coding Challenge (JavaScript)


When I shared the opportunity to offer a few FAANG level mock interviews, a current coding bootcamp student decided to throw his hat into the ring and try it out. This is the 2nd episode (out of 3) with these mock interview coding challenges. This one ended up turning into more of a coaching session with tons of great advice for other aspiring developers as well. I hope this helps. Enjoy!

Guests:
Daniel Tomko - https://www.linkedin.com/in/danieltomko
Thinh Phan - https://www.linkedin.com/in/codethinh

---------------------------------------------------

🤝  Join our junior friendly developer community:
https://discord.gg/H69QqZ8MVJ

🔥  Want more personalized help from me? Here are the paid mentorship and review services I offer:
https://calendly.com/donthedeveloper

❤️  If you find my content helpful, please consider supporting me by becoming a channel member and get access to additional perks. Every little contribution helps and is actually used to pay my bills.
https://www.patreon.com/donthedeveloper

---------------------------------------------------

Disclosure: Some of the links below are affiliate links. This means that, at zero cost to you, I will earn an affiliate commission if you click through the link and finalize a purchase.

📚  Web development books and other products I recommend:
https://www.amazon.com/shop/donthedeveloper

Transcript
Don Hansen:

All right. Welcome back to another thing. Level mock interview. Uh, for this one, we brought on someone that wanted to come on. He's a current coding bootcamp student, so he's still pretty early on in his process, but he's been a part of our community for a while. And I just want to give him the opportunity to, you know, try this type of interview out, see what it's like, see what he still has to learn. Um, just a heads up this turned into more of a coaching session, but I feel like a lot of the advice and the way that Daniel guides him through. Is pretty solid. And I think it's going to be helpful for a lot of people out there. Uh, but Daniel's going to be the interviewer. He's been a software engineer at Microsoft for 10 years. Uh, he's been a software engineer at Facebook for seven years, and then he's currently at formation just. People accelerate their careers. So hope you like it. Enjoy.

Daniel Tomko:

All right, well, uh, hello, 10. Uh, my name is Daniel. Uh, am I saying your name correctly? The 10. Is that

Thinh Phan:

right? Yes. Hi Daniel. My name is tin. You got all right.

Daniel Tomko:

Awesome. Nice to meet you. And thanks for taking time on your Friday afternoon, maybe where you are. It's Friday afternoon here. So happy Friday. Thank

Thinh Phan:

you. Yeah. Happy Friday. It is around four o'clock in California,

Daniel Tomko:

so. Oh, awesome. Okay. Well I'm just north of you in the Bellevue Washington area, so, okay, awesome. Well, yeah, again, thanks for taking the time to spend with us and work through a problem. I hope this is a lot of fun. Uh, just a little bit about me. So you kind of know who you're talking to and, uh, in case you have any questions, um, I was a software engineer for about 20 years, so I've mostly worked at Microsoft and then Facebook for much of that time. Um, and then I've been at a couple of small companies since right now. Uh, I'm actually at formation, which is a career accelerator and I'm working on instruction, not engineering. So we have an engineering team, but I actually work on teaching and building content. And. Helping engineers. So that's kinda my story. Uh, this is going to be a, uh, pretty much straight up coding interview. Okay. Um, I have a question for you already to go in the coder pad. So unless there's any questions that you have, uh, you can get the problem, a read, and then hopefully you'll have questions at that point.

Thinh Phan:

Uh, yeah, let's go ahead and get to the problem then. Yeah, sure. So have the quarter pet open here says given award lowercase letters, homely and set of tiles, lowercase letters, plus underscore determined the point value possible for them. Yeah, the score represents a blank tile that can stand in for any letter, but has a zero point value points. Poor tiles are as listed here. And, uh, I guess the example we have is the word is cats. The tiles are T M O C H. And the result is five, uh, three plus one plus one equals five. So I'm a little confused. That's okay.

Daniel Tomko:

Yeah, that's totally fine. You're welcome to, to ask a lot of questions.

Thinh Phan:

Okay. So given a word and a set of towels, determined the point value possible.

Daniel Tomko:

so effectively, we're going to try to make the word using the given tiles. Okay. And every time we use a tile, we will accumulate some score. Right. So if you see, like on online 13, where I say the result is five. If we look in the table lines, say. We'll see that the point of value for a C is three. Right? Right. And so we have a seat. We can make that. So we can, we can score that three. And then the a is a one and the T is a one. So it's possible for us to make the word and the total score we will achieve making that word is, is five. That makes sense. So now let's look at the second example. The word again is cat. Uh, the tiles are a little different. Right. You have the TMO way. We do not have a C, but we do have an underscore. So now this time we can still make the word, but we don't score that three points for the C. Okay. Cause we use the underscore as kind of a wild card. Got it. Okay. So we do score a one for the, a, and the one for the, for the T.

Thinh Phan:

Okay. So it's kind of like a Scrabble

Daniel Tomko:

game. It's kind of exactly a scrambled. Okay. I try to not phrase questions in terms of things that I would like, like, oh, I've never played Scrabble before, and that is not a disqualifying thing to, I've never played Scrabble. So I try to phrase them in other ways, but yeah, it's Scrabble and these are actually the Scrabble points that.

Thinh Phan:

Okay. Uh, yeah, I was a little confused about the second example with Honda's score went. Now you explained it well. Okay. Thank you. Um, so there's no numbers, it's just letters case

Daniel Tomko:

does not matter. Yeah, well, let's just ignore case completely. And like I said, online too, the word will be lowercase letters only, and the tiles will be lowercase letters only plus underscore right. Know, w I'm not gonna, I'm not gonna worry about, you know, throwing in white space or capital letters that doesn't make the problem. Interesting. It only makes the problem annoying.

Thinh Phan:

Great. Okay. So yeah, the first option I see to solving this is just taking the, the word I were given and just iterating over each letter and assigning each letter. To uh, to give the reside pen. Okay. Yeah. So, um, some other options, but I'm not really familiar or comfortable with. Okay. Is this, I guess just with map, but I'm not, yeah. I'm not too familiar with the syntax of and everything.

Daniel Tomko:

Okay. So how would you use map? How do you want to use maps?

Thinh Phan:

So I think, uh, it's kind of like an object where you put in, uh, a key and any returns, the value. So we can do something like that. W

Daniel Tomko:

sure. But how are we going to apply it in this case to solve the problem? Um, like what are the, what are, what are going to be the keys and what are going to be the values and how is that potentially gonna hit? Sure.

Thinh Phan:

It's a, so let's say if the word is cats and, um, if we have a map or an object to store the key, be like for letter C Bree. Okay. A is two T is one as well. Okay. And then, um, And the values area and then put it into a result.

Daniel Tomko:

I see. So you're proposing that we would iterate through the word and use the map to count the letters in that word. Yes. So I'm sorry. I said the wrong thing. Are we counting letters or are we assigning point value?

Thinh Phan:

Um, so we would be signing the point policies. Sorry. Okay.

Daniel Tomko:

So how would we deal with a word? Like,

Thinh Phan:

so it would just give the, is it cause it's two CS, is that what we're concerned about? Yeah, I guess it will iterate through every letter still. So it would still give the value twice. I

Daniel Tomko:

see. So what you would end up with here is a V, which is what a four. And then, and then an a is a, is the one. And then you would end up with what here for the C

Thinh Phan:

it would be three, then it would go over the. The word again and I'll do another value

Daniel Tomko:

everything's yelling, right? Uh, I see. Okay. So when you, when w if you use the same key twice in a map, uh, what happens like if you do. Him like let's assume Amazon is a map. If we do M of C three, and then we do M go to C equals three what's in the map. We'll just say like M is a

Thinh Phan:

MP map. What's

Daniel Tomko:

in the map after

Thinh Phan:

line 31. Uh, I am not sure. Would it just be CS three is still,

Daniel Tomko:

yeah, it would just be one, one C mapping to a value of three or four. If we did four here value at would be four, you know, so we wouldn't end up having it. Wouldn't look like this. It wouldn't look with, to see mapping because threes.

Thinh Phan:

Okay. So for that, then I guess this solution wouldn't work well,

Daniel Tomko:

it doesn't work as, as we we've described it so far, but is there anything we can do to, to maybe solve that problem? Or can we use a map in a different way or, um, or do you want to go back and, and, uh, explore your, uh, your first approach more?

Thinh Phan:

Uh, yeah, we can do that. I think that's something we can, uh, definitely. So, yeah,

Daniel Tomko:

let's, uh, it's, it's your call.

Thinh Phan:

Okay. So for that, we would just do, uh, I guess create like some type of dictionary to put all the values together.

Daniel Tomko:

Wait, are we sticking with the dictionary approach? Are we going back to your initial approach?

Thinh Phan:

I'm

Daniel Tomko:

sorry. That's okay. I just want to know where we're going. That's okay. Let

Thinh Phan:

me. See, I guess initially I had the idea of staring at a bunch of pips statements and then if it's eight and return one, but I don't know if that's too too much,

Daniel Tomko:

uh, I mean there's pros and cons to everything, right? Uh, that's why this is engineering.

Thinh Phan:

Okay. So let's go with that one. Since I, I bet I can do that part. Okay. So it would be a function. Um, so we'll do a four loop to iterate through each letter.

Daniel Tomko:

Now, remember, we're given two things.

Thinh Phan:

Oh, okay. How many tiles do you have? Yeah. Okay. So it was one of the things is if you can get that word or,

Daniel Tomko:

oh, like, are you asking if it might not be possible to make the word? Yes. Yeah, it is definitely not always possible to make the word. Okay.

Thinh Phan:

So I guess X case is if, um, Word does not food tiles. Let's

Daniel Tomko:

see. Well, let's, let's pause for a sec. Let's come up with a, let's come up with a handful of examples. So like I gave you two examples, let's come up with some more. Let's actually like find some, a bunch of interesting cases. So you just correctly identified one of the other cases, which is, Hey, wait a minute. We might not be able to make the word. Um, let's, let's actually list out some of those cases. Okay. We can just extend my comment block here and. Let's write out some more examples.

Thinh Phan:

Sure. So let's say another word of sure. Add the tiles of AB and C. Great.

Daniel Tomko:

Yup. What's the result here? It's

Thinh Phan:

insane. Invalid.

Daniel Tomko:

Yeah. Uh, so this is, this is an interesting choice. Let's just say, let's just say it's minus one, right? Since we're returning a number, you know, a score value let's return a score value. That's clearly like, uh, outside of what we expect that we can easily test for. Okay. Rather than like, oh, in some cases we'll, we're turning into JIRA and other cases we'll return a string like, oh yeah. You know, it's a little hard to deal with.

Thinh Phan:

Um, so

Daniel Tomko:

that's a good test case. I like it. Let's uh, let's come up with a couple more. Okay.

Thinh Phan:

That's another one would be, I don't know, uh, do another animal. I'm not sure I like it. So, uh,

Daniel Tomko:

yeah, so what's an interesting test case. Like how can we like. Push the bounds of our understanding of the problem.

Thinh Phan:

Let's see.

Daniel Tomko:

Yeah. Trivial Tesla case, like this is also always good. Can we make a duck out of a duck? Yes. Uh, so not, not to say there's no value in this, but we should be at this point, it's really exploring the bounds of the problem, that our understanding of the problem. Right.

Thinh Phan:

Okay. So I'm trying to think of other interesting, uh, except I can't really,

Daniel Tomko:

yeah. Here, I'll you think of another example? I'll I'll fill in the answer on that one.

Thinh Phan:

So,

Daniel Tomko:

what are you thinking about?

Thinh Phan:

Um, just not thinking no crazy example is the only one who is like, if you're at all mild piles. Yeah. I think

Daniel Tomko:

that's a good, yeah, I like that one. Uh, how many week let's put a note in here. Yeah, 1, 2, 3, 4, 5. Okay. That's five,

Thinh Phan:

right?

Daniel Tomko:

Make a snake. We can make a duck. We can make a dog.

Thinh Phan:

Yeah.

Daniel Tomko:

And then do not

Thinh Phan:

get any points, I guess a four, the word D does it have to be an actual word or it can be like any,

Daniel Tomko:

oh, that's a good question. Yeah. Let's not worry about it. Valid words are invalid words at this point. Yeah. But come on. I liked her animal theme.

Thinh Phan:

Yeah, no, yeah,

Daniel Tomko:

yeah, no, I think that's a really good one. All right. Okay. So how do we then start to write our code in a way to, to handle these, these different cases

Thinh Phan:

let's see.

Daniel Tomko:

Or, you know, how, how do we, how do we structure our.

Thinh Phan:

I'm not too sure. Let's see.

Daniel Tomko:

Well, here's the question based on the code, you were starting to write it line 34.

Thinh Phan:

Okay.

Daniel Tomko:

At what point do you know if you're not going to be able to make the word.

Thinh Phan:

Um, at the beginning, when we receive our parameters,

Daniel Tomko:

how do you know right at the beginning? Or how, how will the pewter know right at the beginning?

Thinh Phan:

Um, if the word has the tiles in the word.

Daniel Tomko:

Okay. Can you express that in one line? By the way that's not a challenge. Uh, this is a rhetorical question. We will write the densest code possible, but no, no, no, no, no. Let's

Thinh Phan:

not do that. Um, I'm not sure. So.

Daniel Tomko:

You w the thought you expressed, like, yeah, we need to check to see if the letters in the word are available in the tiles. That's the right concept. Right. But we need to take that concept and break it down into steps that the computer can do. Okay. Um, so we, can't just, I would argue, we can't just know this at the beginning. We're going to actually have to write some code to figure that out. Okay. Right. And, and so, so now we we've now identified two things that this code needs to do. Right. It needs to determine if the word is even possible, given our tiles. And if it is possible, it needs to total up the number of points available. Right. Okay. Right. We could potentially do that as two different steps. Like, Hey, is this person. Check it out. Right. And then as a second step, Hey, if we know it's possible, let's find the score or we could actually do these in one, in one pass in one step. I actually don't care which way we do it. Um, but both of these, both of these operations are going to take more than one line of code, right?

Thinh Phan:

Okay. So yeah, I think separating, it would be better for me. All right, let's do that. But now I'm not too sure how to do this.

Daniel Tomko:

So you started writing a writing a four loop on online 35. What were, what were you, where were you going with that? And actually, I, I might even recommend at this point that we don't write code that we actually write. Comments. Okay. And we actually write in comments, the ideas we want to express, and we can iteratively break those down to a level where they can look more and more like code. Right.

Thinh Phan:

Okay. So yeah. Let me write some comments

Daniel Tomko:

here. Yeah. Like w like what, what do you think the steps are going to be to accomplish these tasks? Okay.

Thinh Phan:

So initially I was thinking of going through. Um, to the word I just typing

Daniel Tomko:

in what we decided. So you, you keep typing, I'm going to type around you here for a second. It's it's it's good. Yeah. Yeah.

Thinh Phan:

And then I'm checking the value of each letter and then. I mean some, I use the letters.

Daniel Tomko:

So hang on here just a sec. Cause we decided we were going to do this in two steps. Step one. Is, is the word possible with these tiles or no, not for these tiles with these tiles, with these tiles. So then step two, if the word is possible now, Uh, some of the total points. Right? So, so these are two steps. Uh, yes. Which are you working on right now? Well,

Thinh Phan:

this one was two would be the second. Yeah. Okay, good.

Daniel Tomko:

Yeah. So let's, this is why I like this sort of like high-level sketching and like comment approach. Cause it helps you keep your thoughts organized in terms of like, well, wait, what am I trying to do right now? Oh, I'm checking for possible later on. Well, yeah, there you go. Okay.

Thinh Phan:

Okay, cool. So, yeah, so for that one, I think should be given, but the first part is, uh, sure. How I would go about this. So if I, how to check if we have, if, uh, Oh, Tyler and Maury. Okay. So we're

Daniel Tomko:

going to check if the tiles are in the word, are we going to check if the letters of the word are in the tiles?

Thinh Phan:

Yeah. Which way are we? Here. I'm going to just give ourselves a little bit

Daniel Tomko:

of space here. Yeah, there we go. I'll get this one more,

Thinh Phan:

just

Daniel Tomko:

really disliked. This editor. Never does what I expect it to do.

Thinh Phan:

Yeah. So for this one, I'm not too sure how I would go about this. Yeah.

Daniel Tomko:

So, so it sounds like we're gonna meet some iteration over the letters of the word. And then we got to figure out if that letter is in our tile set. Okay. Yeah. So like, I think line third, the comment on line 39, we're actually going to do something similar. Right, right. Check to see not what, not what the values are this time, but like, Hey, do we have that letter?

Thinh Phan:

Okay. Yeah. So if I do a for-loop for that, um, how would I compare it to tiles? Yeah.

Daniel Tomko:

Um, yeah, there's, there's a couple of things we can do here. Okay. Um, one question. Do we want the parameters word in tiles? Do we want, are those going to be strings? Are they going to be a res containing single character? We contribute to convert one to the other, but, you know, uh, if, if we, if you, if we have one, we can convert it to the other, which whichever way, but let's actually get crisp about which one we have. So we know what we're working with.

Thinh Phan:

Sure. Let's say they're raised since I

Daniel Tomko:

think. Okay. Let's just say they're a res

Thinh Phan:

yeah. Uh, we'll just keep

Daniel Tomko:

it worried. Yeah. Yeah. If I'm going to add a comment here, just saying these are rates. Okay.

Thinh Phan:

Single characters. Okay.

Daniel Tomko:

All right, so we've got to raise, how can we look? How can we look in an array then? Determine if something is there.

Thinh Phan:

Um, that's all I was not too familiar with. I know there's includes the, uh, the map there, but I never used it.

Daniel Tomko:

Okay. Um, I mean, we can also write a method to do that as well. Right. We can write our own. Okay. Yep. Are you good? You're right there, there, there is a, um, there is a function in a JavaScript array that we can use to, just, to, to find out. We can also write it if we have to it's okay. It's a simple four loop, actually, that that's probably a worthwhile thing. Let's do that.

Thinh Phan:

So

Daniel Tomko:

we'll just call it contains, um, and we'll give it an array and we'll give it a character. Okay, so let's, let's just write, let's just write this for starters. So this is going to return

Thinh Phan:

now

Daniel Tomko:

when a true false value. Yes. This is in the array or no, this is not an array. So let's so how do we, how do we write that?

Thinh Phan:

If the, you said C is in the ring? Yeah, this is,

Daniel Tomko:

this is the test. If C is in.

Thinh Phan:

Okay, so

Daniel Tomko:

true if it is and false otherwise.

Thinh Phan:

Okay. So I think we would just do like a four loop and then nuclear every, yeah. Great. Let's do it. Okay. So for. Uh, T equals two. Okay. I see. Yeah.

Daniel Tomko:

Uh, it kinda almost works, mostly works. So if it's a Boolean function, there's one return statement and that particular return statement always returns. True. We probably want to return to false at some 0.0. Okay. But two, four loops get an L statement. Do it during Ellis block.

Thinh Phan:

Oh

Daniel Tomko:

yes. Yeah, there we go. Yeah. Now, uh, it would actually work without this because you would return undefined and undefined is foresee. But this is much better style and it's much clearer, right? Yeah. This is it it'll break less code also, because what if, what if a caller was actually explicitly testing for false, that would, is undefined false. Right. So yeah, this is, this is much better. Okay, cool. So now we have a way to test. If our tiles array contains some letter. Now let's jump back down and start thinking about using that.

Thinh Phan:

Okay. So down here, if we do a similar thing, Um, how would I use the contains

Daniel Tomko:

function? Yeah. Well, I'm looking at your, your note online 43.

Thinh Phan:

Okay. So if we. Puts words. let me see.

Daniel Tomko:

So how many times do we want to call contains?

Thinh Phan:

Um, so this one takes an array and checks. If, is this letter? So as many times as there are in tiles, how many tiles we have,

Daniel Tomko:

uh, So where are we? So, yeah, so we're definitely gonna call contains more than once. Are we, are we going to iterate over tiles and call it once per tile? Or are we going to iterate over words and call it once per letter in the word?

Thinh Phan:

Um, pride over the word.

Daniel Tomko:

Okay. Okay. I like it.

Thinh Phan:

Let me smell. And yeah, I'm still a little confused on how to implement here.

Daniel Tomko:

Okay. Well, just like we're iterating over an array on line 34 word is an array of, of letters. So we can pretty much use the same type of for-loop to iterate over those, um, to iterate over the letters in the word. Okay.

Thinh Phan:

Uh, the yellow, we'll start with that before he's here and change this to, so here, we'll say if. And the future

Daniel Tomko:

we'll remember contains is gonna return true or false. So can we call it right here and then make a decision about, about what to do or, or can we make a decision at this point about what to do?

Thinh Phan:

Okay. So. Yes. So if it has the tile tiles, then it would return true and we can,

Daniel Tomko:

yeah. Then contains will return. True. And, and, and what are we and what can we do at that point? And when it returns false, what can we do at that point? Okay.

Thinh Phan:

So if it returns true, then we can do the next step. Something.

Daniel Tomko:

And maybe how many times does it have to return? True?

Thinh Phan:

Uh, all the whole

Daniel Tomko:

word. Yeah. Right. Every time we call it, it has to return true. If it ever returns false, then what are we going to do?

Thinh Phan:

Uh, then, oh, I see. Then we'll um, we'll do the negative one result, right? Okay. Yeah.

Daniel Tomko:

Okay. So how do we, how do we make that work online? 45.

Thinh Phan:

Let me say, uh, you haven't so lost her now.

Daniel Tomko:

Sorry. Okay. All right. So let's, let's just call. Um, and so now what's the question we're asking of campaigns. What, what, what is the array we want to pass? And what's the character we want to pass.

Thinh Phan:

Okay. So I guess theory would be tiles. Okay. Yup. And then the, uh, that would be the word them. Yeah. Okay. Let's do it. Okay. Sorry. So 10 pills. Uh, okay.

Daniel Tomko:

Yeah, because it's going to be a re like, look in here, look for this thing, right? Okay. Yeah. Okay, cool. And now. Which, so it might return true. It might return false. One of these two cases, we can make an absolute determination of what our final result is going to be. Is it the true case or is it the false case?

Thinh Phan:

The final result? Yeah, let me see. No,

Daniel Tomko:

only, only one of the two cases we can make a final determination of what our functions should be.

Thinh Phan:

Uh, the false one, the false case. Why is that? He is, uh, oh, we haven't determined the total points,

Daniel Tomko:

right. Okay. Yeah. Okay. So let's make this, let's make this the false case. Let's say if it doesn't contain right. Or we can, we can do that by like, And if contains re returns a false, then what do we want to do online? 46.

Thinh Phan:

Then we will return a native one here. Yeah. Yeah.

Daniel Tomko:

Okay. Let's let's do this. Let's put a return zero here for now. Right. So at this point, we're either going to return negative one or we're gonna return zero. That's cool. Let's let's test this right. Let let's actually test this on a couple of our cases. I'll put in the first one here. Okay. So we're going to have C

Thinh Phan:

uh, A T

Daniel Tomko:

and we're going to have.

Thinh Phan:

Okay. So that looks right

Daniel Tomko:

now. Right. And we expect this now to return zero, which isn't the correct answer in the end, but that's fine. We know that we've determined. We know that it's possible. Not a minus one, right? Yeah. Okay. So let's, let's run this.

Thinh Phan:

Okay.

Daniel Tomko:

We got what we expected. Um, when I hand it off to you to put in a couple other interesting test cases and let's, uh, let's see what this does.

Thinh Phan:

Okay. Okay. So let's say if it doesn't have a,

Daniel Tomko:

we can just copy this line and start modifying it to yeah. To make some other, some of our other interesting test cases

Thinh Phan:

to, and say, we don't have any tiles and how do we run it?

Daniel Tomko:

Uh, you can hit the run button up at the top. Okay, actually, minus one is right. We just didn't update our expected results. Okay. I see. Yeah. It's just sort of my little style here of like, Hey, we ran, we tried this thing we sorta wanted to get that. Did we get it? Yeah. Yeah. Okay. All right. So, so far we were passing a couple of test cases. Let's say let's try a couple

Thinh Phan:

others. Okay. So I have B wilds. Yeah. Work with that.

Daniel Tomko:

Yeah. So what do we expect in this case should be zero Y

Thinh Phan:

um, because actually, if we had one, I guess, do we need three wilds, two for each letter, I guess. Yeah. Okay. So if we add, we have these.

Daniel Tomko:

Well, I think this is still a good test case we should have, we should have both. We should have a one wild card gates, which we expect a minus one, and we should have a three wild card case. In which case we would expect a zero at this point.

Thinh Phan:

Uh oh yeah. Cause we didn't code that out yet.

Daniel Tomko:

Yeah. Well, cause we, yeah, we haven't, we haven't had little wildcards yet. Yeah. Okay, cool. Let's uh, what about,

Thinh Phan:

um, What about, uh, oh no,

Daniel Tomko:

actually I want to grab this one. Like this is, uh, let's actually, this is one of our test cases that I gave you above. Let's actually put that one in. Let's also just put in. What if, uh, what if it's a funny version of cat hat? So in this case, we expect a zero because we'll use the wildcard in place of the a, and then in this one, we would expect a minus one because we don't have enough. A's actually, let's put the AA back in here to make it a little easier to understand what's going on in this case. We, yeah, we still going to want a minus one because, uh, because we don't have enough. Yeah. So let's run that. Yeah. And we'll see that we now we've, we've got a bunch of discrepancies here. Right. But we're, we're, we're making progress on, uh, on the problem. Okay. How do we, how do we need to change this and update this to, to start handling some of these other cases? So we haven't done anything with wildcards. Um, for starters, that's one, I think there's, I think there's two problems here. That's one of them.

Thinh Phan:

So it's a wildcards, I guess, for this, that contains, if can we put four here? We're going to work.

Daniel Tomko:

Uh, no, not quite, although I see what you're I see what you're trying to do. Um, we can express that same thing this way by doing an or, and then, right. So like, is that character the thing we want or is it a w or is it a wild card? I. I would actually argue against this approach, right. Because what we're doing is we're taking a function that had a very simple idea and we're making that more complicated. I think we can, we can do this same thing in another way. That's a lot more clear. What we could do is we could call contains with the letter, like we're doing online 45. Okay. And then if that doesn't give us what we want. We could try calling it again with an underscore. It's like, oh, you didn't have a C. Okay, well maybe that's fine. Do you have an underscore? Okay. Right. We can just call the function again. Um, and that keeps our, our function really clean and simple and single purpose. Right. And kind of makes it easier to test easier to debug, easier to reuse. I love functions that are very short and simple and express a single idea clearly.

Thinh Phan:

Okay. So where would we put that ought to be put in an LCF down here or,

Daniel Tomko:

yeah, we could, well, is it an LSF, like in what, in what situation do we want to check for an underscore? Let's put it that. Is it the, is it the case where we have the letter in our tiles or is it the case where we don't?

Thinh Phan:

We don't.

Daniel Tomko:

Yeah. So backs now in here. We on 9 45. We're checking. Hey, do we have the letter? And then now if, if the answer was no, we got a false, excuse me. Um, now in the side that if statement, we can check again, like, oh, we didn't have that. All right. Try to, do you have a wild card? Do you have a, do you have an underscore? Okay.

Thinh Phan:

So are you able to nest them inside of each other? Yeah. Um,

Daniel Tomko:

yeah, I

Thinh Phan:

think we're dismissing. I think of her in

Daniel Tomko:

there. Oh yeah. Yeah. There we go. I kind of dislike auto denting systems. That's okay. Uh, yeah. Okay. So if the character isn't there. And we also don't have an underscore then. Yeah. Get outta here minus one. We're done. Right. Okay. Let's uh, let's run this now. Yeah. Okay. So, um, we're now passing a few more test cases and we're still failing. It looks like to the last one and the second to last or the third to last one here. I'm going to group these things together here.

Thinh Phan:

Uh, Yeah, that one. Right? So, so

Daniel Tomko:

why am I, so why, why are these two failing?

Thinh Phan:

Uh, the two on bottom. It says we haven't done the, uh, the summing.

Daniel Tomko:

Uh, no, it's not this, it's not that we're not doing the summit yet. We're not even testing the summing yet. Right. Because we would actually expect to, um, we actually expect a minus one here, right? Yes. We, we, we, we don't even expect to get to the part of the algorithm, like the step two online, 52. We're not even expecting to get this. But in fact, we are getting there because we returned to a zero expected a minus one. So what's the situation that we're missing.

Thinh Phan:

Let's see. So they don't have the word or the tiles on the score then.

Daniel Tomko:

Yeah. That's your native one. We'll like, like, look at the, I'm going to move one more line, even though it's passing, I'm going to move that to the bottom. What's the difference between this line? Why does this one

Thinh Phan:

work? No one does it. Uh, this one right now only has one wildcard. So. It's only,

Daniel Tomko:

right? Yeah. So, so we don't need to just check if we have that character, we need to know if we have enough of them. I see. Okay. Yeah. So, um, this is where we might want to use a map, or if we find something that we can use, we might want to remove it from our title. Right. Like once we find like, oh, we're going to use a C. Okay. Well, once we've used the C, when we're done, there might be another C, but we've used the first one. And then similarly, like if we use a wildcard, okay, well now we've used it. We can't use it again. So we, we need to either modify our tiles array by removing things. Once we've used them, or we need some other strategy. And here's where the map. Your map idea from the very beginning, this may come into play because if we have a map that counts the number of tiles we have, oh, we have a one underscore and we have one T right. Once we use the T we can change that one to a zero. And now we know that we don't have any more. We can keep track of things via counting that way, like, or we could just modify the erase and actually remove things. Um, So I think this is, this is actually a really good place to stop. Uh, do you have, do you have questions for me?

Thinh Phan:

Um, many questions, but I'll leave that for another time.

Daniel Tomko:

Yeah. Give me one or two. I mean, this is, this is a, uh, potentially a very valuable part of the conference.

Thinh Phan:

Um, yeah. Yeah. And what do you think, like some of the fundamentals that I should be learning?

Daniel Tomko:

Sure. Okay. Well that's yeah, that, um, we were gonna get there no matter what. So you're, you're jumping, you're jumping straight to it and that's fine. Um, okay. So the bottom line is, um, you should definitely be very comfortable with map. Uh, cause that is something that comes up, especially in front end development. You know, when you're, when you're working with information, being handed to you by, by a user who's actually like hammering on the app. Like these, they come up all the, all the time. Okay. So, um, you know, kind of as a, uh, sort of a strategic thing, definitely practice with maps. Um, The second thing is, uh, and this is a really common, a common, uh, situation, especially in interviews. Um, and I see people all the time, take a problem and jump too quickly into code and they jump into code before they've thoroughly understood both the problem, which is step one, understand the problem and to. I understand the idea that they're about to implement in code. If you don't yet understand the idea of the algorithm, there is no way you're going to get the code right. With any, uh, reasonable probability, right? You always have an idea and intention when you go to either write a function or even make a change to a single line of code you, your idea might not may or may not be. And that's okay. Right? Like we all right bugs from time to time. Right. But if you're not writing code with intention, then it's hard to even know if what you wrote is good or not. Like I intend to write this okay. For this reason, does it do that? Does it get me anywhere towards my goal? Right now you can ask a question. Right? And so even if it doesn't work, you have the opportunity to be productive. Right. But if you're writing code before you fully understand the problem and without intention, then it's really hard to even ask yourself a question of like, do I like what I have do? I think this is going in a good direction because you don't have something to compare it to. You don't have an idea of an algorithm in your head to be, to look like, look at the code. And like, does this implement, does this implement the algebra? Right. And like, I see this a lot where, um, somebody will write a line of code and I'll ask them what the line of code does. And they answer by reading the line of code. And that immediately tells me that, that they didn't write that line with intention. Right. Because I can read the code too, but what are they trying to accomplish? Like what does that supposed to do? Like, why are we iterating through an array? Right. Um, you know, so getting really clear with, and clearly delineate the steps in your problem solving process. You'll, you'll make fewer mistakes and you'll actually turn what might otherwise be a mistake into an opportunity to correct it. And, and actually. Get the task accomplished. Right. Because you'll have that basis of comparison. Right. Okay. Um, so, but like, this is really common. I think this happens in interviews a lot, just because in an interview they're. Is very real time pressure. Like we have a limited amount of time to talk with each other this afternoon. And in a, uh, in a real interview, you know, this might be the first one of four or five, right? So after this one, like we have to be done because the next person is going to like be jumping onto the call. Um, so there is time pressure, and that's real. Right. And so there's this perception that, well, you better just hurry it along and write the. But if you haven't like intellectually solved the problem yet, um, you're probably actually going to take more time because you're gonna make silly mistakes. All right.

Don Hansen:

That was the interview. So I mean, kudos to tin. He's still going through his current coding bootcamp and he decided to take a challenge that was very, very difficult. So, and I think he handled it really well. He's a, he's a humble guy. And I appreciate that. I think a lot of employers are gonna appreciate that. So good luck with your journey tin. Hopefully this is how. Um, this was problem one out of two. So we've had two people so far that haven't gotten to the second problem, but we are doing one more mock interview. That's going to be released in about a week from now, and I'll give you a heads up this person. We already recorded it. This person did reach the second problem. So you're going to get to see that, but yeah, shout out to formation. I appreciate, uh, you know, Daniel coming on and doing these mock interview. So, yeah, that's pretty much it. Um, let me know what you think is the comments I'll see in the next interview.