I would love to see more of these. It's a nice addition to your other types of videos.
@WebDevSimplified5 жыл бұрын
Thanks. I definitely plan to continue with this series.
@neliyagurung45843 жыл бұрын
@@WebDevSimplified u stopped making these
@kran3993 жыл бұрын
@@WebDevSimplified They why Stopped making this Series. your broken your Promise 🙄
@thedude1426 ай бұрын
Almost every time im looking up a programming concept on here, without fail, i find you covering it. Thank you for all you do 🤙
@WebDevSimplified5 жыл бұрын
Thanks for watching! If you enjoyed the video please let me know, because I would love to make more videos about algorithms. Also, don't forget to tryout the algorithm yourself on LeetCode, and view my code from this video on my GitHub. LeetCode: leetcode.com/problems/two-sum/ GitHub: github.com/WebDevSimplified/JavaScript-Algorithms/tree/master/Two%20Sum
@MrVolkodaff3 жыл бұрын
This is just a great explanation, algorithms are still a weakness in my code. Thanks for the explanation, Kyle. Enjoy your videos, man.
@RakeshKumar-vg7uv3 жыл бұрын
Video is short and simple but powerful. Thank you so much for making your videos short and always straight to the point
@erinrose57942 жыл бұрын
I would love more algorithm videos! I'm fairly new to coding and this is really helpful for prepping for interviews
@skafaced102 Жыл бұрын
I've been using "Cracking the Coding Interview" (although dense, this is a great book to have) and ZTF Master the Coding Interview: Data Structures + Algorithms on Udemy! The udemy course is great because the instructor breaks big O and fundamental algos down for you as well as how to approach each data structure. However I use Web Dev Simplified all the time! He knows how to explain useful tools quickly and efficiently. Thought I would at least share some additional resources I've felt helpful for me as I prepare for interviews.
@Train38163 жыл бұрын
Please keep making videos! I’ve been binge watching your channel every chance I get. I’ve truly learned so much, thank you!
@georgemccaddeniii89635 жыл бұрын
Thank you for this video, Kyle. I'm preparing for some big interviews and I wanted to see this problem white boarded and coded out. You helped me really understand this approach and now I'll build upon this knowledge when working through others like it.
@WebDevSimplified5 жыл бұрын
I'm really glad I could help
@itsyourronit2 жыл бұрын
I really enjoyed it, no jargons, nothing that already makes someone feel sick, everything so simplified, I love this channel and the way Kyle tells stuff! It goes directly inside of my brain and resides there permanently
@jasper50162 жыл бұрын
OMG, Can you believe that I was looking for the exact problem? Thanks a lot
@miw8793 жыл бұрын
I was struggling from one tutorial to another with there complex code, but I swear to god I'm not even lying when I found your video first I smiled because I was already damn sure that now I'm gonna understand it for sure because there is no questioning YOU ARE THE BEST TEACHER. I instantly knew I'm gonna get this now go my notebook up wrote with you and now I fully understand it..... From the bottom of my heart, THANK YOU VERY MUCH ❤ Please upload more algorithms from leetcode!
@bartekfigatowski79805 жыл бұрын
I liked it, more algorithms, please😁👍🙏
@WebDevSimplified5 жыл бұрын
Will do!
@loljakkon Жыл бұрын
thanks man you explained this so well, I was able to find the solution after making my own long if statement nightmare and i couldnt understand that second solution when i was first looking at it, i didnt realize how they were saving into that object variable originally
@veremox3 жыл бұрын
omg man, that way of doing this challenge is mind blowing! i am new to js and god, i've learned a lot just by watching it, interpreting the algorithm and then redoing it by myself!! very awesome!!!! this way of storing past values on a object like its a mapped bucket of information is incredible! opened a lot of doors in my head :O thanks! =)
@zecosta95795 жыл бұрын
Great tutorial, I think a series of this would be well received
@WebDevSimplified5 жыл бұрын
Thanks. Based on how well received this video has been a series is highly likely.
@zecosta95795 жыл бұрын
@@WebDevSimplified That's awesome!
@NirajKumar-bi5vo Жыл бұрын
Enjoyed your algorithm videos. Keep making more of such videos
@alicenyw1872 Жыл бұрын
I loved this! I never had to use algorithms before, but the job market seems to be more competitive right now, so I am encountering algorithms during interviews.
@crestmarinaris61135 жыл бұрын
This is super insightful. =) No other channel goes through algorithm and challenged so elegantly. Thank you for the video. Would love to see more of these.
@WebDevSimplified5 жыл бұрын
Thanks. I am already planning out the next video.
@PATRICKCHUAD2 жыл бұрын
very fast algorithm. Thanks for sharing. is the complexity of this algorithm equal to O(n) since there is only 1 loop ? O(n) is linear ?
@chips-n-salsa3 жыл бұрын
thank you for making this....just starting on algos so this is super helpful!
@mahrig18295 жыл бұрын
Agree with other comments. Very happy to see these kind of videos (more advanced Javascript, problem solving, algorithms). Another great video!
@WebDevSimplified5 жыл бұрын
Thanks. I plan to make more videos like this of all difficulty levels.
@adriandeaconu54685 жыл бұрын
Mate, I love your videos, you are very talented, keep up the good work. Like honestly, I watch plenty of channels just to stay in touch with different programming languages, but for some reason, you got me hooked up.
@WebDevSimplified5 жыл бұрын
Thank you! I really appreciate it.
@baefaux3 жыл бұрын
I've been teaching myself to code with JS and I actually understood what you were explaining! I can't wait till I write a program that I can implement this in!
@pandat2473 Жыл бұрын
Need more content like this sir😭💖 This is really good please make some more videos like this Love from India 💗💗
@abdulmayeedchowdhury13974 жыл бұрын
Loved the way you described it. Thanks.
@elva329 Жыл бұрын
Enjoyed your videos very much. Could you please continue your algorithms series if possible? Thank you
@shisamo4 жыл бұрын
finally found a good explanation of two sum. Thanks a lot
@bac99823 жыл бұрын
Stellar video. Even as a Python guy you make the concepts easy to understand and the whiteboard breakdown was great. Thanks for making the time to make these and for sharing the knowledge with the world!
@upmate27263 жыл бұрын
Nice one. Thank you for a comprehensive explanation
@shelbyrothman45222 жыл бұрын
Everything you do is gold!
@abhijeetgupta27545 жыл бұрын
One of the best youtube channel for learning good stuff and I would like to see more videos like this.
@WebDevSimplified5 жыл бұрын
Thanks. My next video will be another algorithms video. I hope you enjoy it.
@caiquevallim2209 Жыл бұрын
Which book would u recomend sir? :) I'm senior dev and now I'm going to focus on learning fatests solutions to solve problems and in order to improve my skills
@jaimemontesdeoca79892 жыл бұрын
As always, a very helpful video. Thank you Kyle!
@esportsnexus4 жыл бұрын
Awesome! Please make some leetcode series of medium & hard problems!
@vladimirmikulic78605 жыл бұрын
Please do more of this Algorithms type of videos. Great explanation BTW.
@WebDevSimplified5 жыл бұрын
Thanks! Did the white board explanation help with your understanding or would you prefer more of just coding?
@vladimirmikulic78605 жыл бұрын
@@WebDevSimplified The whiteboard explanation was brilliant, I would love to see you explaining algorithm videos on a whiteboard. For me personally, it's easier to understand and it feels like a real interview :)
@WebDevSimplified5 жыл бұрын
@@vladimirmikulic7860 thanks for the feedback. I was really hoping the white board would be beneficial, because that is the kind of content I find most useful. I'll make sure to keep the white board in future videos. Hopefully I can even upgrade to a whiteboard I dont have to hold.
@vladimirmikulic78605 жыл бұрын
@@WebDevSimplified No need to thank me, thank you! I really appreciate the effort that you put in these videos.
@trangnusi133 жыл бұрын
Thank you! Please make more videos like this. You are really helpful!
@BluePhoenixGames15 жыл бұрын
Great video! More videos about algorithms from you would be really appreciated
@WebDevSimplified5 жыл бұрын
Will do!
@oop_web77075 жыл бұрын
Thank you for the video. If you can, please do more algorithms.I'm new in JS and I really want to understanding this part. Thank you in advance
@WebDevSimplified5 жыл бұрын
My video coming out tomorrow is another algorithm video.
@olivermelichercik97883 жыл бұрын
Really enjoying these!
@thatsenam91832 жыл бұрын
I would love to see more videos like this one.
@betoduarte92073 жыл бұрын
Hello, awesome video! What would make this video even better though is if you walk through a number set and show how an example actually flows through the algorithm. Thanks for posting!
@stith_pragya10 ай бұрын
Thank You So Much for this wonderful video............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@bhavikrathod74934 жыл бұрын
I have enjoyed and learnt a lot from your videos. keep going!
@mr.webdev37005 жыл бұрын
That was a great explanation! Good job! 👍👍👍👍👍
@WebDevSimplified5 жыл бұрын
Thanks! I'm glad you enjoyed it.
@chanduallada24174 жыл бұрын
I would like to see these kind of videos... it will be very useful for interview preparation Thanks for ur efforts 👌🏻👌🏻👌🏻
@at43713 жыл бұрын
Thank you. Yours is excellent , but I come up with this too. step 1. get the difference (target - a[i]) step 2. search that difference if it exists in the array list using indexOf(diff) pitfall , indexOf could find same index , so we should not consider it. (n != i) var twoSum = function(a, p) { var n=-1; for( var i = 0; i < a.length; i++) { var dif = p - a[i]; n = a.indexOf(dif); if(n != -1 && n != i) { // to return [i , n] } } };
@joematkin25544 жыл бұрын
Hi thanks for the video, please can you explain why you didn't set the target to 9
@lookhsu77053 ай бұрын
I like this! Thanks for sharing.
@qwertykeypad7895 жыл бұрын
Love it bro, you did a great job. I learned this way of solving problems using hashing in C++ but after seeing in javascript its amazing. You explained it very well. Looking forward to see more videos like that 👍🏻
@WebDevSimplified5 жыл бұрын
Thanks!
@SaifaldeenSAH4 жыл бұрын
Thank you very much!, really enjoyed your explaining way, hoping to see more like that.
@singamsettyrupeshkumar87464 жыл бұрын
How target - current number will work I don't get tht can you explain once !
@CH-tw7wb4 жыл бұрын
I'm always stuck with brute force methods, I just can't come up with a clever algorithm even for the easy ones. When you first started solving coding challenges, were you able to easily figure out efficient algorithms or were you also stuck with only brute force methods? If so, how did you change that?
@djbilly59132 жыл бұрын
I fully feel the same...Just got to keep working
@bones1343 Жыл бұрын
I’ve struggled with the same thing until I learned about the different problem solving patterns. They’re good tools that help you optimize your solution. In this example Kyle uses a frequency counter. I’d suggest starting with easy problems using a pattern and gradually start solving more difficult ones until you really understand how it works. Hope this helps!
@IswearIwasBatman3 жыл бұрын
Dont you have to push values from nums array into the prevValue array? How else would the prevValue array store previous values of Nums array?
@rojehhabib6482 жыл бұрын
It is actually an object and when you do prevValue[value] = x you are basically assigning a key and a value to it
@zafarsultanov11242 жыл бұрын
I love algorithms pls restart this course again
@sjsjdjyktjt24575 жыл бұрын
Good stuff man! Just wondering, why did you set the variable "previousValues" as an object? Wouldn't initializing it as an array work the same way? Or is there a fundamental difference? Thanks!
@WebDevSimplified5 жыл бұрын
If you use an array instead of an object then whatever the neededValue is that you are storing as the key of the object for example 1000 would be the index of the array. This would mean you would need to have an array that takes up at least 1000 spots in memory. Usually when you are working with large numbers like this or when you will potentially have many empty locations in the array then an object is better suited.
@Jason-mx8dl3 жыл бұрын
Wait, where did the ‘index’ variable come from on line 13 when you return [index2, index]?
@pareenjapuneet3 жыл бұрын
He fixed it at 5:54 to i.
@pinpon1632 жыл бұрын
For better space complexity, could we also check if the current value is not already >= to the target before hashing it?
@samuelhimmelstrup7993 жыл бұрын
What I don't get is why it is more efficient to look up if a value exists in the previousValues (object?). I mean, how does looking up something (a key:value pair) differ from iteration through something (looking through rest of the array)? You mentioned that the previousValues variable is a hash, but I haven't found a good explanation as to why it is quicker to look up something in a hash tables. Anyone knows this?
@VedantKulkarni6194 жыл бұрын
Really awesome explanation and solution. Do you have a playlist?
@tdpencil28114 жыл бұрын
You can try going through every value and putting the target - the value in a hashmap, then you can constantly lookup the value to see if it's there. That is O(n) time. (not to mention freakishly fast).
@gabrieldiaz65093 жыл бұрын
The videos i always need
@thattoofunny5 жыл бұрын
Great video. More algorithms please......
@WebDevSimplified5 жыл бұрын
Thanks! I can't wait to make the next video.
@bikramchettri94055 жыл бұрын
Thanks for the detailed and simple explanation.
@WebDevSimplified5 жыл бұрын
You're welcome!
@bikramchettri94055 жыл бұрын
@@WebDevSimplified Hey can you do a video on oop in javascript.
@WebDevSimplified5 жыл бұрын
@@bikramchettri9405 I will add it to my list.
@bikramchettri94055 жыл бұрын
@@WebDevSimplified I love your explanation man, that's the only reason i am giving you a lot of trouble. Accept my apology.
@WebDevSimplified5 жыл бұрын
@@bikramchettri9405 this is no trouble at all. I enjoy getting feedback and suggestions from viewers. I just have so many video ideas I need to use a list to keep track of them all or I forget the ideas too easily.
@markemerson982 жыл бұрын
awesome: more leetcodes please buddy
@brianwebdev19583 жыл бұрын
Thanks, that was very helpful
@DigitalFire50003 жыл бұрын
what is the point of the empty object. How does this empty object not always return null since nothing is pushed inside of it?
@cesargabrielmuozcedeo30462 жыл бұрын
It has helped a lot. Thanks!
@anagh48024 жыл бұрын
This was really helpful! Thanks a lot. Also more of these please.
@baiai65094 жыл бұрын
thank you, clear and understandable but can we solve it with a hashmap?
@conceptualdeveloper Жыл бұрын
Yes, Algorithm series should be good..
@jakeschwartz46413 жыл бұрын
Thank you for the awesome videos!
@AnkitKumar-di2sj2 жыл бұрын
Hey! I have a doubt, in JavaScript variables declared with "const" keyword cannot be reassigned. Then how is it possible that at line no 9 the CurrentNumber is assigned values Multiple times when the loop runs. Please help
@EntEduRealm2 жыл бұрын
kzbin.info/www/bejne/iZ27eqB7ap1pg7s watch this for all solution if you dont understand this
@Spades3405 жыл бұрын
This was a good vid. I haven't been doing so well in coding challenges for job interviews. Do you recommend anything else for me to get better in addition to grinding Leetcode problems?
@WebDevSimplified5 жыл бұрын
Make sure to really read the solution and fully understand the parts that you get stuck on. This will help your problem solving skills immensely and will make it so that even if you cannot solve the problem you can hopefully explain a good enough approach to solving the problem that it won't matter. Also if you struggle with algorithms like I do then focus on making projects that are really good and the employer will care less about your algorithm skills if they can see you have already created real projects.
@stardriver86604 жыл бұрын
Hi Kyle could you go over questions on leetcode just like this one, it just helped me so much. So many answers on leetcode is not that reliable and hard to understand. Please consider, thank you!
@dilshodturabov2 жыл бұрын
i love you every video lesson
@VillageJoker3 жыл бұрын
Thanks for this dude !!!
@samueltorres24852 жыл бұрын
Please do more leetcode stuff with detailed explanations!
@EntEduRealm2 жыл бұрын
kzbin.info/www/bejne/iZ27eqB7ap1pg7s watch this for all solution
@ShanilPanara3 жыл бұрын
This was great! Thanks!!
@tr-dev92 Жыл бұрын
Hey love the entry !😂
@fganiev2 жыл бұрын
This is great, thanks!
@extremespartan1175 жыл бұрын
Muy bueno! I suppose you could add visuals to give a even more clearer explanation but otherwise this was really good!
@WebDevSimplified5 жыл бұрын
Gracias. What kind of visuals would you like to see for a video like this?
@AnnieTaylorChen5 жыл бұрын
I like it you're trying different ways of presentation. Algorithm is definitely one of my weakest points, so I would love to see of those too! :) As a beginner I don't seem to come up with the faster solution naturally, even you explained and I read your code, it took me a while to understand it. Can you add more animation to explain more visually? Such as we can visually see the index numbers flying into the object previousValues as the code runs? So what's the best way to think "smarter"? Should I watch more similar videos?
@WebDevSimplified5 жыл бұрын
I thought about adding some basic animation to this video, but ultimately was limited on time. I think I might try doing something like that for the next video though as long as it is applicable. As for getting better at algorithms the two best things you can do are practice a lot and read/watch explanations of the solution. I would try to solve a problem and then when you feel confident about your solution check an explanation of the solution.
@infyro2 жыл бұрын
Great explanation! Although i'm still a bit confused about something in the algorithm if someone doesn't mind explaining it to me: I'm still a bit unclear as to how 'i' is getting returned on line 13 if index2 != null is true. Can someone explain how the corresponding index is automatically returned after the conditional?
@nestroyertv2 жыл бұрын
So as you now , you can access object properties via its key. Whats happening here is he is creating an entry in the "dictionary"(normally referred as hashmap) where its KEY=NUMBER and its VALUE=INDEX. When he substracts the current number value to the target value the result is the KEY that he needs to look for in the "dictionary", if the dictionary contains an entry for that KEY we retrieve the value , which in this case is the index, meaning we already have our combination of indexes. If not he stores the index and value as an entry to the dictionary, that way he can look it up later. Hope this helps!
@LawZist5 жыл бұрын
Great stuff! Already waiting for you next video
@WebDevSimplified5 жыл бұрын
I'm already planning out the next algorithm video I want to cover. It is really fun to solve the problems.
@AmarKumar-lv1wu5 жыл бұрын
Awesome but what is index in return which you specified with the return [index2,index]
@WebDevSimplified5 жыл бұрын
In is just a number which is the position of the array that we are at.
@rovsenhuseynov83684 жыл бұрын
Thank you for the useful video.
@gomez46652 жыл бұрын
in line 10 what is the value of neededValue? is it 9, 8, 7, 6 ?
@MontyKsycki5 жыл бұрын
THANK YOU VERY MUCH!!!! VERY MUCH APPRECIATED!!!! THANKS FOR SHARING!!! HAVE A GREAT DAY!!! :)
@vishnumithran45744 жыл бұрын
hey I loved the video.. please upload similar contents
@pswr20093 жыл бұрын
Super helpful!
@JustThink20003 жыл бұрын
I like how you explain
@savannahlin80635 жыл бұрын
Yes!Yes! I enjoy it. It's so helpful and useful.
@WebDevSimplified5 жыл бұрын
Thank you! I am really glad I could help.
@vishaltaywade80695 жыл бұрын
Really appreciate your test cases video 👍🙏 Cheers now I can able to understand js algorithms!!! Thank you so much! please do some more videos on and complications test
@WebDevSimplified5 жыл бұрын
Thank you. I have another algorithm video coming out in a couple weeks!
@ajwaters53235 жыл бұрын
These are great! Definitely more of these!
@WebDevSimplified5 жыл бұрын
I'm working on the next one right now. I'm hoping to have it out in the next week.
@thatsenam91832 жыл бұрын
Best video ever
@stephanieonyekaba82742 жыл бұрын
Just a heads up this solution ONLY works if the array of numbers are in ascending order. an array of nums such as [3, 2, 4] will not work because 6 - 3 is 3
@flythetbm99095 жыл бұрын
These are great. More please!
@algorithmtrader2 жыл бұрын
the way you just popped up in the beginning always has me dead
@vladimirjean5 жыл бұрын
That was very helpful, can you make more videos like that, I'd really appreciate it. Thanks!
@WebDevSimplified5 жыл бұрын
I'm really glad I could help. I definitely plan to continue this series. I have already started on the next video.