Doing more these kinds of things is very helpful, especially how u approach them. Teachers normally tell us the optimal solution but how to get to that or how to come up with that solution is not normally taught to us.
As a mostly self taught dev, I really appreciate your content. It has helped me grasp concepts I've been struggling with for a very long time. Thank you!!
I definitely want more videos like this! You're an excellent teacher. I'm trying to get a job as a Java developer and I'm freshening up my knowledge. I will always come back to your videos. They are fun, interesting topics, easy explained and very helpful! 😃
If you struggle with finding a first job, try to look for testers, then get to automate tester, then you will be a perfect java coder because you know how stuff should work. Requirements for junior tester are so little, it is easy to apply
More of these types of videos would be fantastic! Your explanations throughout all of your videos are incredible, and I just started tackling coding challenges and I've been struggling with how to even begin. Appreciate your channel so much!
I'm new to this channal. Before I saw this video I don't knew what is really hashmap is but after seeing this..... Nothing to say. This video is really helpful. Thank's for creating this awesome video.
In order to create a stash of solutions to common problems, I'd love to see more of such videos, taught by someone who really knows what he's doing and who can teach in a clear and straightforward manner. Thanks for sharing this knowledge.
Thank you John for taking the time in creating this video! Please do more of these videos as it teaches problem solving skills and how to walk through the creation of an algorithm. Thanks!
All of your videos have been so incredibly helpful to a career changing CS student like myself! Leetcode has always seemed super intimidating but your teaching style really makes them seem doable. Please do more like this!
Thanks for the encouragement at the end. My solution is close but not quite optimal. It's O(n) space complexity but O(2n) time complexity. I felt bad about not thinking about the hashmap solution until you gave your encouraging words at the end! Thanks man 🥺
Yes.. Nice. Coding is not just getting the correct result. But it also getting the result in correct/optimal way. Please deliver this type of videos which really brain storm and change the thinking way of coding.
From what I know first solution is: O(n*(n-1)/2) and for the outer loop you should do: for (int i = 0; i < nums.length - 1; i++) Of course it still can be simplified to O(n²) - but never really understand why. I mean it's quadratic, but still quite a reasonable difference to loop i and j from 0 to end. (about half the time of O(n²), which I think is still a difference, especially if it is longer, like from 20 mins to 10 mins)
Dude!! Thanks a lot for this video!! I was straggling with this same question in the AlgoExpert, and I couldn’t understood the Clément's explanation. You explained SO MUCH better, and for free... Please launch a course of Algorithms and Data Structure. I'll definitely pay for that.
Hi John , waiting for the next episode , it will really help to broaden the logical thinking . I'm a java developer, but never imagined hashmap can be used in such a way.
Thank you. This was super interesting (to me, anyway). Please give us a few of these every now and then - I'm not asking you to make it exclusive, but it was fun.
Thank you for covering such problems and that too in detail. We usually don't get such insights when doing things alone. Please park some time for adding such videos regularly. Thank you
I really needed to hear that last bit in the end. im a 2nd yr cs student and ab to do my first technical test for an internship n i find them very hard and even thought of dropping out lol. so thank you
That thing you said at the end... That makes me feel so much better about myself. I used to feel like there's something wrong with me, but it's natural, apparently!
It took me a week to "sink in " but I solved my first leetcode with this video , thanks God this video Exist and Thank you John for creating such an amazing video .
9:44 The solution will return [2, 2] for a target off 8 which is incorrect since the same element is used twice. The code for the "i" should be for (int i = 0; i < nums.length - 1; i++) {...} For the i, j loop version.
I really appreciate the message you start to give at 21:57 - I have been feeling very discouraged as of late trying to sharpen my problem solving skills and it was very comforting to hear that. Thank you!
Would definitely like to see more challenges! Never would've thought about using a hashmap and like you said, one more thing I've learnt. Thanks a million. You're a great teacher!
Two sum was my first experience to how useful hash maps were. Started using them in all tasks where you need to look at every unique element of an array.
I was stuck for hours looking on how to write the first line of code on such leetcode problems....leetcode can be intimidating but thanks for such content, it really helps!!....please do more especially in java
My freaking God John, that was the best explanation I've found so far on the internet. Sure there could be more ways but the fact that you are able to explain it so easily and also the way you communicate as a speaker is remarkable. Keep doing what you do buddy, and thanks a lot. ❤ from INDIA. I feel blessed that we have people like you working with JAVA.
Hi John, i love this video. Learning algo on Leetcode is hard even with looking at the solution. However this video helped me understand 2 sum very easily. Thank you
I have to agree with the majority of the other comments - your explanations of algorithms for solving LeetCode solutions (well, in general good software algorithms) are some of the clearest I've seen. This is probably going to be a new subcategory of videos that you might not have planned to do, but I can see there's so much interest you have no choice but to do them! (Please?)
Just started my Leetcode journey and this was the exact video I needed to feel more confident about trying more problem and being ok about not knowing the best answer or an answer at all. You thoroughly explained 2 ways of solving the Two Sum problem and reassured me that practicing more leetcode will sharpen my eye for finding solutions to coding problems. IMO this is a must watch for all first time leetcoders! Thank you John 🫶
Please do these kind of videos.. because of your great explanation about hashmap now i understood it.. Before i know what is a map, set but i don't know how they actually work..now i know Thankyou
Hi John, the way you explained is more clear and more precise so I suggest you do this kind of video more and make it a playlist for Leetcode easy problems, People who are new to Leetcode like me would appreciate more content like this.
Yes more leet code/algo videos, there’s barely any good Java leet code videos on RU-vid. Mostly just python and JavaScript videos. Java is neglected on leet code.
I'd love to see more videos about what you talked about at the last min of the video: "I never would have thought of that!". Your way of explaining the thought process is exactly what I'm looking for in these types of videos. I don't just want to see the solution to this or that coding problem, but the idea behind it. Please keep them coming!
Great video, John! What sets you apart is that you have a very clear communication style, and you're very encouraging as well. I think that this LeetCode video showcases those skills really well, and it would be awesome if you made more in the future :)
this video is amazing!! thanks for all the explanation, please continue with this! Im using java to do these code challenges and your videos helps me a lot
Hey John, Thanks so much for your videos they have being really helpful to my java knowledge. I would love to see more videos from you on Arrays, OOP and Real life application of Arrays and OOP. Thanks a million. Big thumb 👍
Please John keep them coming I'm a university 3rd yr student and tbh I would have never been able to out that approach. I don't know when i will be able to think like other programmers 😩
These videos are really helpful for beginners like me in Java. - Everything I learned in College was very basic and a few things didn't make much sense to me, but now that I am watching your videos, and going step by step with your tutorials, makes a lot more sense and I can understand a lot more than I did while in my course. I have seen these kind of code challenges in HackerRank and Codility for job applications, and they can be really hard for beginners like me. However, with tutorials like this one, I am pretty sure next time we have to complete a code challenge, it will not be as difficult. So, thanks for your videos, it would be nice if you keep posting tutorials of challenges similar to this one. It is a good way of learning.
Hi John, thank you for the solution, I would have never thought of solving it that way... But I did some minor changes to your code: public int[] twoSum(int[] nums, int target) { HashMap map = new HashMap(); for (int i = 0; i < nums.length; i++) { if (map.containsKey(target - nums[i])) { return new int[]{i, map.get(target - nums[i])}; } map.put(nums[i], i); } return nums; } and I got these results: Runtime: 1 ms, faster than 99.76% of Java online submissions for Two Sum. Memory Usage: 42.2 MB, less than 96.76% of Java online submissions for Two Sum. :)