May 11, 2022

FAANG Level Mock Interview (Entry Level / JavaScript)


I invited on a Wordpress developer of 3 years to tackle an entry-level FAANG mock interview in JavaScript. Quite frankly, most people are too scared to come on to do this, so kudos to Milos for being willing to tackle these problems on video! The interviewer, Daniel, was a software engineer at Google for 10 years and at Facebook for 7 years. It sounded like this type of challenge was more in line with Facebook's style, but hopefully, this gives you some insight into what challenges are like at these companies.

We will be doing 3 mock interviews in total with these problems. This episode is with the first brave soul. Enjoy!

Guests:
Daniel Tomko - https://www.linkedin.com/in/danieltomko
Milos Veljkovic - https://www.linkedin.com/in/milosveljkovic1992

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

🤝  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:

Welcome back to another mock interview. This one's going to be a thing level mock interview formation. Thank you for lending me. One of your instructors, uh, Daniel, who is the interviewer has been at Microsoft as a software engineer for about 10 years, Facebook for about seven. So I think this should be a really good mock interview, especially if you want to get a feel for what they're like, but yeah. Uh, there's two problems and we'll see how far the interviewee gets. Good luck.

Daniel Tomko:

Yeah. All right. Well, thanks for taking time to talk with us this morning. This is going to be a lot of fun. Um, yeah. Uh, and I just want to make sure I'm saying your name correctly. It's Meloche is that right? Yeah. Okay, great. Um, yeah, there's a little bit about me. So you know who you're talking to. Um, I've been an engineer for about 20 years, mostly at Microsoft than at Facebook for a long time. Most of my careers at those two companies on lots of different teams then was at a small, a small company here in Seattle for a little while before I then shifted gears. And now I am head of instruction at a small company, uh, based out of San Francisco. We're a career accelerator called formation. Um, and I spend most of my time teaching and writing content and, uh, helping people become better software engineers. Uh, it's been a ton of fun. I'm relatively new at it. Uh, like tell me a little more about yourself. Love show.

Milos Veljkovic:

Uh, yeah, so I I've been working as a developer for a small agency here in Serbia. Uh, and I been, um, creating websites using WordPress, but I last year I decided to learn an actual programming language. So I done it pretty cold courses on front-end. There are three courses on three goals camp. Then after that I, uh, attended the screen book courses also for front-end. So JavaScript and react, and now I'm currently looking for an employment. So yeah, basically. Awesome. My

Daniel Tomko:

skills. I love it. We're both taking on new challenges. Very,

Milos Veljkovic:

very cool.

Daniel Tomko:

Well, uh, let's, let's dive right into, uh, the, the, the first coding problem of the day. Uh, it sounds like JavaScript is a, is an okay language for you. Um, I have things set up in JavaScript already, but if we, if you prefer TypeScript or something else. Okay. All right. Let's let's do that. Awesome. We'll please, uh, take a look at the question, give it a read and then, uh, ask any questions,

Milos Veljkovic:

um, um, uh, determined the point value possible for the word. What is the point value? Okay.

Daniel Tomko:

And if you look at lines 6, 7, 8, there are values associated with every letter. Yeah.

Milos Veljkovic:

So how many times do you need it? Okay. Okay. Okay. So those are points. Continue raising the question. Yeah. Yeah, no, it's okay.

Daniel Tomko:

Yeah. I should send you have them, but you know,

Milos Veljkovic:

yeah.

Daniel Tomko:

oh, I made a mistake here. I'm sorry. Yeah,

Milos Veljkovic:

I'll be faster. Um, and she, in the example, so don't worry, this gets the tiles or TM. Oh, CA why? Why is there an M

Daniel Tomko:

oh, oh, good question. So the tiles represent letters that I have available to make a word. Oh, right. So, so if I'm looking at these tiles and I'm wondering to myself, what words can I make? Oh, given these letters, I could make the word cat. I don't necessarily have to use all of the available letters to make the word. So the tile set is not necessarily going to be an anagram. Of the word.

Milos Veljkovic:

Yeah. So let me reread that. Yeah. Okay. So I get the string and I get that. Yeah. So what happens, uh, if, uh, if there's no tiles that the real match the string, or is it 100% that it

Daniel Tomko:

will, that's an entirely reasonable question. So if the word is not possible to be made, just returned minus one, Oh, hang on. Don't type that you, you keep thinking because I'm prepared. I don't want you to spend your time. What format do you want the tiles in? Like what type of data structure do you want them in?

Milos Veljkovic:

It could be an NRA.

Daniel Tomko:

An array. Oh, I see. Okay.

Milos Veljkovic:

Here's what I have, so,

Daniel Tomko:

okay, so let's type code on the other side. So here, uh, yeah, that's where we're going to write code and then actually wouldn't we run the code. The output is going to be on the other side. So, if you want to just test the line, like, you know, you can write a single line over there and run it, but we actually want to write the code. Oh, wait, you removed everything.

Milos Veljkovic:

No, uh, oh, where did I go? Okay, there we go.

Daniel Tomko:

Yeah. So you can, you can write your code, like your, I see your cursor at line 27. Yeah. We can just start writing code there. And then when we run it, we'll see the output over on the other side.

Milos Veljkovic:

So I'm thinking about looping through the IRA and matching the, the selector. So we see you as a, just a second to think of the best.

Daniel Tomko:

Yeah. And please think out loud. Like if you, if you have an idea, yeah.

Milos Veljkovic:

Maybe, maybe I'm not. Okay. So yeah, I'm thinking about, and comparing that to the letter. So let's you call this. I want to see what this returns

Daniel Tomko:

run experiments. I love

Milos Veljkovic:

it. Yeah. Yeah. So I can have it from yeah.

Daniel Tomko:

From code wars. Yeah. I don't know this. I have to look it up

Milos Veljkovic:

like.

Daniel Tomko:

Oh, okay.

Milos Veljkovic:

So yeah, so we get this so we could use the comment, this the. Okay. One this case, all the letters. Yeah. Dishes, the second biggest case. So we should disregard this. Yes. So, so

Daniel Tomko:

let's pause here and talk about that for a sec. So notice that there is no sea in the tile set. Yeah. But there is a TNA. Yeah. And we have a blank, so we can only make cat in this case because we can use the blank, but we don't get those three points.

Milos Veljkovic:

Sure. So. Thinking about the sorting theory. So the underscores come last so I could keep the track of the letters found and the remaining letters, if they mentioned the number of underscores, then yeah, we can have the source, but for example, we have only one underscore, then we could not,

Daniel Tomko:

for every letter in the word, we either need an actual occurrence of that letter or we need an underscore to fill in for it. Yeah.

Milos Veljkovic:

Okay. So let's do this may not be at an optimal sort of let's do this first. Inside of that, or I count the instances of the underscore in the string. So I'm not sure which solution would work better if the string is extra long, then it would be a looping through an RA more than I should.

Daniel Tomko:

Uh, which, which solution,

Milos Veljkovic:

uh, this is something else I had in mind that I first looked through NRA count the number of underscore instances. And then I could use that in this way. So, yeah. Okay. Let's do that first. If you get any sense,

Daniel Tomko:

you're going with the counting approach.

Milos Veljkovic:

Just to be clear. Okay, cool. Yeah, we could use so, yeah,

Daniel Tomko:

I don't want to spend the time to look up.

Milos Veljkovic:

Not sure. Watching the course multiple times and they get it by 10.

Daniel Tomko:

Yeah. It's rederick is rejects is one of those things where if you don't use it all the time, it's even, it's, it's hard to remember all the little subtle things. Yeah. So you like, you use that every day or you kind of have to think carefully about

Milos Veljkovic:

it. They basically did nothing. Yeah. So I shouldn't, but yeah. Okay. So that's what make me, so

Daniel Tomko:

yeah. Notice that letter values. These are not the tiles themselves. These are the values of the tiles. So, so like let's just try sticking, you know, this is our tile set.

Milos Veljkovic:

Yeah. We can just

Daniel Tomko:

use this as a global variable. I'm fine

Milos Veljkovic:

with that. Just a sec. I have to return it. Yeah. So I should compare it. So yeah, I suppose I kind of missed my mark.

Daniel Tomko:

So let let's pause for just a sec.

Milos Veljkovic:

So.

Daniel Tomko:

No, no, no. Let's back up just a little bit. Let's talk about counting the underscores for a sec. Are there ever situations where you need to count the other things also the other tiles, right? My, the tile set might be, you know, and it might be an extra T in here. There might be a right. Are there situations where, where we need to know the count of more than just, just, just those

Milos Veljkovic:

underscores when the letter repeats?

Daniel Tomko:

Yeah. That's an interesting case.

Milos Veljkovic:

Um,

Daniel Tomko:

or, or how do we know if a letter is not there? Right? Like in this case we could have a C or we could have, you know, so now we can make cat two ways. We can make C a T and we can also make underscore H. Yeah, and we should, in this case, we should return five likely let's get all the points we can.

Milos Veljkovic:

Yeah. So I provided a object instead of strings. That's kind of led me in the wrong direction. Yeah. So I should to compare this to this. Yeah. I should compare these two strings. Okay. So of course. Yeah, of course. It's going to be present.

Daniel Tomko:

You need, well, yeah. So you need to add it up only if you have the character available.

Milos Veljkovic:

Yeah.

Daniel Tomko:

Yeah, because we're actually going to have two arrays of characters now.

Milos Veljkovic:

Yeah. Um, so I think,

Daniel Tomko:

you know what to be fair. I am too. I've never done a broadcast interview before, so, you know, this is new for both of us. It's okay. You mean, you thought I've done lots of live broadcasted.

Milos Veljkovic:

Yeah.

Daniel Tomko:

I'm pretending this is why I like to laugh in interviews a little bit, you know, like it's okay.

Milos Veljkovic:

Yeah. Okay.

Daniel Tomko:

Let's actually pause for just a sec for just a moment. Not write code. Let's write comments. Oh, let's just write comments. Yeah, yeah. Yes,

Milos Veljkovic:

exactly. Yeah. My,

Daniel Tomko:

because like, I feel like you're exploring the problem by writing code, but writing code takes more time. So let's explore the problem in a different way as you're, you're actually making progress on the problem on your understanding of the problem. Right. But you're doing it in a slow way. So let's, let's see if we can speed that up by not writing.

Milos Veljkovic:

Okay. So, so

Daniel Tomko:

yeah. And what are the different situations when you're doing this comparison? Like, what are the, what are the different things you need to take into account?

Milos Veljkovic:

So, yeah, that's what. Yeah. Yeah. So, yeah,

Daniel Tomko:

I'm going to make another test case here too. Oh, yeah. Oh yeah, please. Sorry. I didn't mean to hit pause on you. That's what I love about these things. We can both type at the same time. Yeah, no apologies there. That was not my

Milos Veljkovic:

intention. Yeah. So I want to make this as simple for.

Daniel Tomko:

It might be an interesting conversation for the end, because the other way around, I, I tend to write by default four loops of this style. And clearly you tend to write a functional, you know, reduced MapReduce pattern. There's interesting. Trade-offs between the two of them and maybe that's a conversation for later.

Milos Veljkovic:

Hi.

Daniel Tomko:

Wait, is it matches? Yeah. I'm making it clear here that I don't use red jacks all the time. Isn't matched the resident rejects thing. Rejects method. Yeah. I don't think we should. I don't think we should use rejects here.

Milos Veljkovic:

Okay. Yeah. I wanted to see if it matches. So if

Daniel Tomko:

it matches or let's say that in a different way, and I think it might lead you to a,

Milos Veljkovic:

there you go. Yeah. So

Daniel Tomko:

it's funny how language sort of shapes our thinking. Right. We use a word and it leads us down a path.

Milos Veljkovic:

Yeah. Um, I'm not contagious

Daniel Tomko:

strings

Milos Veljkovic:

and includes Mitzi.

Daniel Tomko:

Oh, yeah, the undefined are my console logs at the bottom. Yeah. Okay. So true.

Milos Veljkovic:

Okay. Yup. Okay. So one question. So the styles, so this does not match.

Daniel Tomko:

Uh, line 44. What should the return value be? Um, minus one. Yeah. Agreed. So actually those of us in these little test cases, I often put the return to the expected recurrent value here. And in this one, in this particular

Milos Veljkovic:

case, we should, we should return five. Okay. Yeah. So yeah. Good. We need to take into account this. So this will both correct. I have two of those available. Yeah. So we should, they want to see again, if I need to return. I need to remove it. I need to know where it is. So I can,

Daniel Tomko:

you were onto something at the beginning though, you, at the beginning of this, you were doing something where you were going to count the number of underscores. Yeah. Can you, can you riff on that idea a little bit?

Milos Veljkovic:

So, yeah. Um, I knew I wanted to count the number of underscores. So if I am missing two letters, 200 scores, then it's okay. It's

Daniel Tomko:

okay. Right. But you don't just need the counts of the underscores. What do you, what do you

Milos Veljkovic:

need? Yeah.

Daniel Tomko:

Yeah. You need to count all your tiles. Yeah. Yeah. You need the counts of everything. Yeah. Everything available. Yeah.

Milos Veljkovic:

But

Daniel Tomko:

like, don't, you also need the count of like owes, for example, in mind 45 test case.

Milos Veljkovic:

Um,

Daniel Tomko:

You want to know how many underscores available, but you also need to know how many O's are available so that like when you consume the first, oh, now you can keep track that, you know, how many do you have left? Well, you know, then we did another one. You know what I mean?

Milos Veljkovic:

Of course,

Daniel Tomko:

happy kids in the

Milos Veljkovic:

background. Yeah. Good. Yeah.

Daniel Tomko:

That's a good thing. That's not a bad thing. Just, Hey, that happens at my house too sometimes. So it's it's okay. This is life, uh, working from home.

Milos Veljkovic:

Exactly. So I want to, uh, for every character I wrote two stories in an object within its own value.

Daniel Tomko:

So are we going to count the letters in the word? Are we going to count

Milos Veljkovic:

the tiles? We, yeah. So if you count the tiles so we can subtract at every instance when it matches. Yeah. That's yeah, I like that. Yeah. So. Just a second.

Daniel Tomko:

Yeah, no, it's okay. This is actually one of the situations where I feel like this functional style of looping actually gets a little bit awkward because there's a side effect, right? You the side effect of, of accumulating these counts, but this way, but yeah, maybe it's because I'm an old C programmer. I, you know, you're welcome to make fun of old. See programmers.

Milos Veljkovic:

Yeah. When I go

Daniel Tomko:

there,

Milos Veljkovic:

I know. Yeah.

Daniel Tomko:

Oh yeah. That's actually a really interesting way of doing it.

Milos Veljkovic:

Yeah. Okay. Yeah. Yeah.

Daniel Tomko:

Okay.

Milos Veljkovic:

No, this is,

Daniel Tomko:

I actually think map was or, um, yeah, I mean, there's a couple ways you can

Milos Veljkovic:

do it. Uh,

Daniel Tomko:

no. It's okay. Yeah. There we go.

Milos Veljkovic:

So the most basic,

Daniel Tomko:

yeah, no. See, this is a little awkward for me too, cause I just wouldn't, I wouldn't write it this way myself. In fact, let me know that I'm being too. Try it this way. Let's, let's actually split this out onto multiple lines

Milos Veljkovic:

to make it a little bit

Daniel Tomko:

more so that we can, yeah, we can, because you've got assignments and side effects and all kinds of things going on in here. Let's actually make this easier to read. There we go. Right.

Milos Veljkovic:

So you could knock on, it's not undefined. Okay. T S T a, there we go. Yeah. So we, yup. Now we can move through the world and every time we encounter some of this, some of these. Yep. So, okay.

Daniel Tomko:

Interesting side effects and ternary

Milos Veljkovic:

operator. Yeah. So, okay. Maybe or not looping through an array. Um, uh, to basically for me for side effects. Yeah. But, uh, and Matt returns,

Daniel Tomko:

right. It expects a value produced at each thing. Whereas for each we can just like do some side-effects modify the array. Yeah. Yeah, no, I gotcha.

Milos Veljkovic:

So got. Then we need to,

Daniel Tomko:

yeah. Let's not worry about optionality. Let's not think about that. Let's

Milos Veljkovic:

yeah. So, yeah.

Daniel Tomko:

So yeah, we want to check, do we have a title for this letter?

Milos Veljkovic:

Great. I'm

Daniel Tomko:

actually keep typing by the way. I'm going to talk a little bit in type myself, but please don't stop. I'm actually going to reformat this as an if statement. Okay. Since we're not. So the ternary made sense in your, for each like functional, um, operator, but I think it makes less sense down here.

Milos Veljkovic:

Yeah. Um, yeah. Complicated. If I need to do one thing, then the way to go for me, but multiple things then I,

Daniel Tomko:

well, like in the Lambda above we needed, we wanted an expression. We could have also put a block in there with an if statement. Right. But in this case, we're writing, we're writing code. So we might as well like do it block style, um, because we're not actually producing a result here, we're making a decision. So just, uh, I think this is then easier, easier to read. So if we have a tile available,

Milos Veljkovic:

subtract

Daniel Tomko:

one from it. Okay. What, what are other cases? Yeah. Yeah, because I think we're going to have a handful of cases here. So it'll be, it'll be much, much easier to read and hopefully easier for you to write.

Milos Veljkovic:

Yeah. So we wanna, we want to check if there some underscores, right?

Daniel Tomko:

We could, we didn't have a character. So as a backup, can we use an underscore?

Milos Veljkovic:

So those, yeah, these will get how they can real quick.

Daniel Tomko:

No, no, no, no. Let's pause for a sec. Do we actually need it? Do we need that there? So what do we know? Can we build some of this into our, if statement on line 48? Right. We're checking to see if it's greater than zero, but can we have make that test strong enough such that we can just look for underscores at line 50,

Milos Veljkovic:

if it's greater than zero. Can you tell me why? Why would we check for underscores? No,

Daniel Tomko:

we're not going to check for underscores there, but can we, can we make that test at line 48? Strong enough such that at line 50, all we need to do is check for an underscore or is it strong enough already?

Milos Veljkovic:

So yeah, maybe we could incorporate in one other thing here. Yeah, right. And we'll just, we'll just

Daniel Tomko:

voice that out since we're going to use

Milos Veljkovic:

that a bunch

Daniel Tomko:

and there's one more in here too.

Milos Veljkovic:

Yeah. Okay. Keep going. Sorry.

Daniel Tomko:

I was just my little

Milos Veljkovic:

thing that I missed.

Daniel Tomko:

Yeah. That's right. Totally gonna use that one moment here while I coach editor.

Milos Veljkovic:

Yeah. So there is greater than zero.

Daniel Tomko:

I actually think that you're next at line 49 now is strong enough. Because if that, if tiles of letter, it'll either evaluate to a number which will be zero or greater than zero, or it'll evaluate to undefined, in which case undefined is not greater than zero, that's false. So I think we can just fall down to the Ellis block and see and check for underscores. Yeah. So, right. I think that test actually is strong enough. Yeah,

Milos Veljkovic:

yeah,

Daniel Tomko:

yeah. The same test then. Cool. What do we do in this case?

Milos Veljkovic:

Then we subtract this by one. Yeah. We

Daniel Tomko:

will consume an under, uh, an underscore will consume a blank tile. Yeah. Okay, cool. So we're, I think we're, we're almost there. We just need to compute our return value. Right? We're now keeping track of tiles and our tile counts and tile availability.

Milos Veljkovic:

Yeah.

Daniel Tomko:

How do we hear, I'm going to, I'm going to co-gender here. Thank you for that.

Milos Veljkovic:

And then get rid

Daniel Tomko:

of that because that is

Milos Veljkovic:

served its purpose. So it doesn't catch this as well on its way. Uh, but,

Daniel Tomko:

but it, it won't right because we we've, the first test was true. So we fall into the F block. We won't hit them. Yeah, yeah, yeah,

Milos Veljkovic:

yeah, yeah. Sorry. We usually don't. Right. So it's

Daniel Tomko:

sorry if I pushed you down as vital, you're not familiar with

Milos Veljkovic:

perfectly fine, but, um, yeah. So if you can, multiple, if statements, I use them to get

Daniel Tomko:

sure, in this case, these aren't necessarily errors. We just need to now accumulate up our, our total value or decide that we can't. Right. We just decide that that word is not going to work. Given our

Milos Veljkovic:

available tiles. We. These,

Daniel Tomko:

these

Milos Veljkovic:

are included here.

Daniel Tomko:

Yeah, that's right. Yeah. So you can get rid of those. Yep.

Milos Veljkovic:

Co-gender getting rid of it. Let's see where we go.

Daniel Tomko:

All right. Yeah. Okay. So let me, oh, go on. Sorry. Finish what you're saying. Yeah. And then where are we going to return results? Yeah,

Milos Veljkovic:

let's try her.

Daniel Tomko:

Okay. We got the minus one and wait that I,

Milos Veljkovic:

okay. We've

Daniel Tomko:

got one little got one bug here

Milos Veljkovic:

and maybe it's yeah, yeah. So,

Daniel Tomko:

oh, so, oh, my test case was wrong. It should have been good. Okay, awesome. Let's pause there. Let me give you some high level things that I noticed during, during the interview. Um, so the, the top level thing, and I see this often is that. Um, writing code. Yeah. And honestly, I think there's a reason that this is a common occurrence. I think people see somebody who's been doing this for a long time and they see that like, you give up, you give somebody a problem. Who's like really an experienced coder. And they're like, oh, uh, I can just do this, this and this. And then they go, yeah. And it's so you get this impression that somebody who's good should just have the code at their fingertips. Yeah, and I think that's not correct. Right? The difference between somebody who's been doing this for a really long time, and somebody who's been, who has less experience is that the person who's done it a long time has built up a library of techniques. And they they're very practiced at selecting the right ones. Whereas somebody who's got a little bit less experience, they might not have the techniques at the ready and be able to pattern match from the problem into what the right techniques are. Right. So you have to do a little bit more, you have to think a little bit more about the problem. The thing is that like the steps are the same, like understand the problem, you know, pick some techniques to attempt to apply. Maybe some of them work, maybe some of them don't, we, the ones that don't work out, then you're going to make a plan for how to write the code, applying that technique. The experienced coder is actually following all the same steps, even when it appears as though they just went done. Right. It's that first couple of steps in that process happened really fast in their head because they're drawing on previous experience. And so my recommendation is that, especially in an interview, when there's, you know, there's, there's some pressure or there's at least some appearance of pressure is that you should really be careful to not skip those steps because you'll, you'll end up writing code too early and you'll end up having to experiment in code rather than like solving the problem. Intellectually. Yeah. And then, and then writing the code. And then the next thing I noticed might actually be a side effect of the first thing is that when you started writing code, there were some interesting little inconsistencies into how, how you were writing code one example when you were writing code at first, in fact, actually I even see a couple of examples or one example here now. Um, in some places you put semi-colons at the end of the line and other places you didn't now in JavaScript, of course you, you might have, we all might have our opinions on semi-colons being optional or required or whatever. Right. They are optional. However, good style. I wouldn't say dictate that you either do one or the other, right? Personally, I like semi-colons again, I'm an old C guy. Um, I'm not going to judge you for not using them, but if you're inconsistent, it's as the interviewer, I start to ask questions, right. Are you coding with intention? Right. And if, if the style you're writing in has some weird inconsistencies, especially at that kind of a level, it makes me wonder, like, have you really solved the problem yet? Or are you just like trying to throw code at the wall and see what sticks? And so, you know, I, um, I think consistent style is important. I am not going to judge people's style as long as it's somewhat consistent, but again, if you haven't solved the problem, then you, it's harder to code with intention. And then it's hard to get those, those little details. And when you're as an interviewer, when you're watching somebody code, like it's amazing how much information I can pick up about somebody's habits. And what's really important for you as the candidate is to make sure that the signal that you're sending to the interviewer is actually representative to what you would do when you're coding by yourself. Without me watching, right. There were other things you did here that, that seemed like, yeah, you, you, you know, are building experience towards becoming a good, you know, fluent coder. Um, but then there were other things that were like, oh, wait a minute. But is this how you're going to write code every day on the job? Um, and that's, and so that kind of leaves me with some questions, but I think it all comes back to not actually giving yourself the time. To thoroughly solve the problem intellectually first. Right. And then everything kind of starts to come apart a little bit from there. Um, yeah. I like, like we, we ended up with a, with a good solution. You know, you had a, um, a couple of points. You were like, oh, I'm not quite sure if this is optimal or not. How do you feel about this solution with respect to like time and space complexity now?

Milos Veljkovic:

Well, Yeah. I try not to look through the same array more than I need surely. So if I look through the array and then, uh, and then across to another way and loop through the, another array inside the first look then I know something.

Daniel Tomko:

Yeah, great. But we know this is pretty good. Right? You have two loops at the top. There's a loop at line 28 and look at line 29 right inside the split. So there's a linear pass. And then, and then you're doing a linear past account. We could actually combine those two, but that's two linear passes like this, not, you know, one inside the other, so. Okay. Um, yeah, I mean, so this is, this ends up being a linear time linear space, right? I, I think this is. So, yeah, I like it. What did you notice about how the interview went? Do you have feedback for me? What did, yeah. Do you have any comments?

Milos Veljkovic:

Yeah. So, um, you know, this exactly when I was stuck. So you get your foot on the brake at the right time and it's exactly when you need to do so. Um, you paid attention to my thinking process and went like, okay, stop. Let us pause for a minute. Why? In fact, want steps reset? The means the last to point out when I do this challenge, Let's call it the challenge. So I took it seriously in the mind, in the meaning of, uh, restraints. Yeah. So I rushed into it.

Daniel Tomko:

Yeah. Yeah. It like, like if you, if you pause to collect yourself a little bit, it yeah, exactly. I think that's right.

Milos Veljkovic:

Yeah, man. Uh, you picked up on that. Yeah. It really, really meant a lot. So just take a deep breath, look at what I'm doing. So, yeah. And overall, this is one of the best. There was no strict. Okay.

Daniel Tomko:

I'm not sure I know how to

Milos Veljkovic:

do that. Yeah. Yeah.

Daniel Tomko:

I want to talk just for a minute about, about hinting in an interview. Um, so my job as an interviewer is to learn as much as I can about how you solve problems and write code. And if I let you get stuck and I sit there looking stern, pretend to look stern here. Yes, I'm finished. Um, if I, if I let you get stuck, you're not making progress on the problem and I'm not learning anything. Right. Right. So when I give a hint in an interview, it's, it's because I want to keep the interview moving forward and I want to keep learning about you. So I'm always, always thinking to myself, what am I learning right now? What am I learning right now? What else do I need to learn to make a good hiring decision? How do I find that out? And if I let you sit there getting stuck, we are both dead in the water.

Milos Veljkovic:

My brain. I

Daniel Tomko:

know I can't, I haven't figured that out yet. So, so like when, when you're stuck, like I want to let you try to solve the problem, but if you're really stuck, then I need us both to move on. Right. And, and actually sometimes I give, I'll give a hint when it's completely clear to me that the candidate. Is is knows what they're doing. Like if I, so I might decide, Hey, you need help here. And I want to move on to learn something else. Okay, fine. I'm going to help you. I might also move the interview along if I've, if I've become completely convinced that you've got this bye. Okay, cool. Now I'm not, I'm not learning anything anymore. So let's move on to something else where I can learn something. So a hint is isn't actually an indication that you're doing badly. Sometimes it's purely an indication that I want to move on, but I want to learn something else.

Milos Veljkovic:

I redact some imaginary points. So like, uh, I needed to, I

Daniel Tomko:

could go either way. Yeah, right, right. Well, and there are two there. I can give you multiple examples in either direction in this interview. Here's one at the beginning, you started typing out, you started typing something out. Right. And it was, it was clear. I w which was the, um, the values of the, um, of the tiles. Right. And I'm like, okay, you know what you need, I'm going to give it to you because I don't want to sit here and wait for you to type this out. Right. You had made a decision. It was clear that you kind of knew what she wanted. And yeah, you said you wanted an array. And like, I had handy a map, but watching you type that out was not a valuable use of either of our two. And then there were other cases, you know, like w you know, where you, you had had this idea of counting underscores, but we actually needed to count all the things, you know? And so that was at a place where it's like, Hey, wait a minute, let's go back to this idea that you had previously, let's expand on it. Right. So that was a case where I was worried that you were going to kind of get stuck longer than I wanted to. And so that was a chance for me to like, okay, now I want to keep this moving. So let's go back there and revisit that idea. So there's, there's an example in either direction, like, Hey, you know what you need, I'm going to help you along. I want to speed this up and another case where like, actually, you, you need a little bit of help to move on to the next thing, so I can see you write more

Milos Veljkovic:

code. Okay. Yeah. So, uh, the experience, when the song that's like throws the senior year and says, I'm done. Well,

Daniel Tomko:

you know, I've actually in thousands of interviews, I've actually never had that happen. Um, you know, like I've had it happen in classes I'm teaching or like people I'm mentoring, but I've never actually had that happen in an interview. Um, but you know, I'm kind of a coach and teacher by nature. So, you know, I, if somebody throws their hands up, um, I'm like, okay, well let's, let's just, and one thing I have done though, is it for, in a situation where the person I'm interviewing is clearly really bad, I'll just turn it into a teaching session.

Milos Veljkovic:

Oh yeah.

Daniel Tomko:

Right. Because here's my philosophy about interviewing is that I want everyone, I interview. To walk out of the room, wanting the job. I don't care how good or bad you are at the end of the interview. I want you to want the job.

Milos Veljkovic:

Yeah. It's a humbling experience. And if you treat the other person rights, then yeah, yeah,

Daniel Tomko:

yeah. Right. Like, and I have had a couple of interviews in the past where like very, very quickly, it was clear that this person was not going to make the bar. Like, I'm going to give you every chance to make the bar. But if it's clear in five, 10 minutes that like this person is just not ready for the position that I'm interviewing them for. Okay, let's work this through this problem together. Let's turn this into a coaching session. You know, you're going to take something away from it. You're going to have a good experience. You know, that's better for everyone.

Milos Veljkovic:

Yeah, then they appreciate that. And that makes them well at the job.

Daniel Tomko:

Yeah. Yeah, exactly. And even if in the end I say no higher, of course I would in that kind of a situation, they're going to go tell their, their friends like, oh man, I interviewed with this company and I talked to this guy and this, like, it was really nice. Yeah. Right. And then we were like, you should go apply to that company. I didn't get the job, but oh, you should go work there. Right.

Milos Veljkovic:

Exactly.

Don Hansen:

All right. So that was it kudos to the brave soul for coming on and giving this a shot. Uh, he didn't quite get to the second problem, but I think he is humble enough to handle the interview well, and he received the feedback pretty well. So hopefully this helped him grow, but for those watching on YouTube, let me know what you think in the comments. And if you even want to see more interviews like this. Again, thank you. Formation for lending. One of your instructors for those that don't know formation, essentially what I see them as is a company or kind of an educational program that helps people that are already in the industry that are kind of like junior level accelerate their careers much faster when you go to their program. And, you know, I'm pretty critical of programs, but I've talked to Sophie and Michael who lead that program and they're good people. The instructors are all really smart people. So shout out to formation. Thanks again, will be enjoyed.