JavaScript Mock Interview | Online Interview Questions and Answers (Part 3)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
ladies and gentlemen get ready for another episode of JavaScript mock interview this is where I've interviewed one of you my audience and recorded the session and put it on YouTube and today's interviewee is pretty special he's got special JavaScript talent you're gonna see in a moment and when I see how he gets into trouble and gets it gets out of it this was a great way to learn for you those who are actively interviewing or just those who are just learning JavaScript you know you can learn a lot by watching other people code so you learn how to not make certain mistakes and I would recommend having you know a laptop or notepad ready next to you so that when I give a question you can do it simultaneously so you can see how you perform and by the way if you want to be on the hot seat if you want me to take your interview feel free to do so just email me and I will take your interview yeah it could be on JavaScript react angular CSS whichever me I'll provide a link here so get ready for hold on and welcome so let's say if I have an array and it's a number array with all the integers okay I'm just giving a simple example but this could be a complex array right now this is a ordered array so I can explain it to you so I have sorted it but it could be unsorted okay and you know if I look at the different possibilities so if I if I take one number out and add the remaining number so let's say if I take one out right yeah if I take one out so the remaining number is 2 3 & 4 right so if I add 2 3 & 4 I would get 2 Plus 3 plus 4 so that's 5 plus 4 9 right now if I take 2 out then I have 1 3 & 5 right 1 3 & 4 then I would get 8 right similarly I can remove every one of them and rest of the number I can add and I will get a number so there will be like a minimum and maximum in this case it's 9 & 8 but you know for example I know that if I remove 4 then I would have the lowest number right so I want you to find so this function should return you know one is Max and one is [Music] [Music] [Music] correct [Music] oh by the way your mouse is in the middle so if you can move your mouse can you move your mouse [Music] [Music] some Jews [Music] [Music] you can push yeah yeah that's fine just use Allah instead of console.log okay can you move your mouse I think it kind of oh that's the problem I find these missing yes yeah that's fine now if I run this it's coming up with a knob as an object yeah it's coming now yeah okay as you can see many of some is nine and makes it six I need to find the length of this number okay so the length of this number is one two three four four right so equal to four right how can I determine but I don't want you to use I don't want you to convert this number into string otherwise it becomes [Music] [Music] so one thing we know that it's not a floating number it's an integer actually on there 69 because if you go over 16 it becomes invalid [Music] I think we can continuously divide it to 210 okay when it reached zero for example five divided by zero that will return divided by 10 it will return zero [Music] with every division I want to counter it will return Dennis okay okay let's try that I will find it can't be optimizing good better way okay can you move [Music] [Music] [Music] yes there is some some issue so there is a problem with your logic did will problem I should say just a little problem approach is correct yes if we use instead yeah I don't think it would make any difference war would make any difference [Music] yeah that would give you an infinite loop I don't want to do some time it's a line file I know that so would this ever become zero or when would it become zero if you kill anybody number it would not be or you can use a line it will just do multiple yeah I mean generally I would not use a lot but here it makes sense because you know I can see it yeah okay so yeah you will keep returning until it's a smallest number right it's not an infinite loop but it will it will become until it's a smallest smaller than the smallest number yeah is a blocking okay it would stop I'm just I'm just also going through a set yeah so just tell me what what would be number before we stop here [Music] - - it's wrong but is less yeah or what you can do is a floor it every time you divide it yeah so then it will always come to you know it will the number will be always integer and then it will become a zero so now let's think about this can we improve this algorithm I haven't said it underneath but let's let's think about it how can you improve this algorithm it's a tricky one though so basically here it's not much improvement basically what happens every you in let's say if the number is length of ten right you have to do it so you have to do divided ten by ten times right not not a big problem yes but there is a way to actually figure it out without doing that without it's it's a tricky one I it took me a while to figure out so it may not be that easy so I'm just gonna tell you okay okay so usually the number the length of the number integer in JavaScript is 16 okay so that's a mex you can have after that it starts to have some problems right so I think it's 16 18 I'm not sure but let's say this effect maximum length right so knowing that information can you use that information to find out the length of a given number that's a great one yes you can do binary really half do half every time right so eight four yeah that's it that's it yeah so yeah you can try that binary search yes and also I think JavaScript has a number called a mix in T something like just in case yeah right now you can use this but I think Java skip has a max integer or something like I forgot the name of it it has an it's in a number library yeah you can use either is fine yeah now we just want to see how you know because if the length would be the same right so yeah [Music] [Music] can you move your mouse I thinking okay I think it's the result zero [Music] [Music] [Music] not 2 because 2 would be 1 length below okay yes yes and maximum number links so let me review my flow okay it's connect its maximum number in the situation call maximum number and blanks rumblings because bigger than bigger than zero maximum number with become maximum number [Music] bill or the field wo or power increase body has I think if my phone not by the kinetics is in different links for example aid it would be it would be not not sixteen it will be true for example reminder of the division if maximum number if the number over maximum number is less than lessons you know so we we do in the next clue in the next two we we go through the links of the maximum number is eight not sixteen and if the number is larger than eight eight digits so the next in the next iteration the links of the number would be twelve not sixteen yeah so I'm trying to figuring out forgetting how to do to do that okay how to do that first we will take the current links [Music] okay so 8 plus 8 divided by 2 so 8 so 8 plus 8 divided by 2 yeah so that's what you're trying to do okay this is also the first time thinking about it I had this idea but I had never actually so I think you know the best way to do it is a pick a number and then on a pen and paper and try to do the math and then see if it makes sense right and you can take the two two numbers one is like a length like below like length of 1 or something and one take one which is length of 6 and maybe take one which is length of 8 or something right so that you get you capture all the cases otherwise you will get an infinite loop so let yeah let's so let's look at it right so if let's say if you take in a six length of six yeah okay all right so I'm we're running out of time but yeah I think this was great I I really love this I'll try to find the solution in my spare time but yeah yeah that that is the right solution but I guess yeah but this was interesting yes yeah yeah I would definitely say you have very good grasp of JavaScript and your thinking process is I really like your thinking process you you think in a right you know direction so yeah I think you should you know definitely go for you know better yeah I know I don't know what's the situation there like in terms of yeah react is pretty good I think if you learn like a graph QL I think which is really interesting I'm learning right now graph QL or even if you doing react you can learn react native because there's a huge demand of mobile development right and then react native is pretty hot right now so if you do react you can also not react native but I would advise the first learn fundamentals of react which is for you it will be I can see because very strong yeah yes I would I mean I think you can easily run non react it's you can learn react you know I know beaker so I have a tutorial series on react you know feel free to wash it learn for the backend technology learn something like a graph QL and there is a there is a a new stack called grand stack course I forgot you have a search on it which basically graph QL react node and all that stuff right so yeah that would definitely help you yeah and keep in touch yeah all right thank you [Music]
Info
Channel: techsith
Views: 21,231
Rating: 4.8589211 out of 5
Keywords: javaScript live interview, JavaScript mock interview, JavaScript Mock Interview | Online Interview Questions and Answers (Part 2), mock interview, mock interview practice, online interview practice, mock job interview, interview preparation, questions for interviewer, javaScript, Skype interview, phone interview, 2018, 1019, practice interview
Id: hbp6IrCysDs
Channel Id: undefined
Length: 38min 35sec (2315 seconds)
Published: Mon Jul 09 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.