본문 바로가기

열정가득한 개발자의 이야기/Javascript Algorithm

58. Length of Last Word (Javascript)

Hi. it's been a while.

These days, I've started studying JS again.

I solved a JS algorithm problem.

This problem is part of the Top 150 Interview Questions,

so I have to solve it.

 

anyway, I think it is about Array problem.

I first converted the String to an array and then used a for loop and an if statement.

 

We need to save time, so I count backwards like this.

 

 

 

so my submission is~~!! 

 

 

I'm not sure if it's the best solution actually,

but I'm satisfied with the result. It was really hard to solve the problem by myself without Googling, but I solved it 100% on my own. So, I'm proud of myself.👩🏻‍💻😆

 

Now, I'll go to bed. Good night, stranger.

good night stranger.