How to Solve LeetCode Two Sum | Understanding Algorithms

  Рет қаралды 5,816

The Code Creative

The Code Creative

3 жыл бұрын

LeetCode Two Sum (1) solved in JavaScript. I try to explain this common interview algorithm question in the clearest way possible. LeetCode Two Sum: leetcode.com/problems/two-sum/
Created by Gregg Fine.
Download my FREE "Google Search Secrets for Developers" Cheat Sheet:
store.thecodecreative.com/goo...
🗣JOIN the Code Creative Facebook group! :
/ 1612600368887577
🔴Subscribe for more free Code Creative videos: : / @thecodecreative
🌐 The Code Creative Official Website
www.thecodecreative.com/
🎓 The Code Creative Courses
www.thecodecreative.com/courses
✅ Recommended related videos:
Debouncing Explained
• Debouncing Explained |...
Memoization Explained
• JavaScript Memoization...
Sorting in JavaScript Explained
• JavaScript Comparator ...
✅ For business inquiries contact me at gregg@greggfinedev.com
✅ Let's connect:
Twitter - @GreggFine
Instagram - /greggfinedev
Facebook - /hiddentigermusic

Пікірлер: 32
@TheCodeCreative
@TheCodeCreative 3 жыл бұрын
To subscribe to the channel: kzbin.info/door/mOpHGj4JRWCdXhllVTZCVw
@MoodyOmar
@MoodyOmar 2 жыл бұрын
What do mean 700 views!!! I watched maybe 10 leet code two sum videos and by far this is the best! keep it up dude, great job!
@TheCodeCreative
@TheCodeCreative 2 жыл бұрын
Thanks Moody Omar! Let me know if there are any other topics you'd like to see.
@spsdarinda4834
@spsdarinda4834 7 ай бұрын
oh my God the best indepth explanation ever..even chatGPT was unable to explain like this..Thank You Soo Much
@TheCodeCreative
@TheCodeCreative Ай бұрын
You are most welcome!
@henriqueb5637
@henriqueb5637 Жыл бұрын
Definitely one of the best explanations I have ever seen! The only thing I didn't quite get is this hashmap data structure. Even after some researching I was still not able to understand what is a hashmap in javascript and how it is different from a simple object. Could you please shed a light on that? Thank you so much
@thedevguild7525
@thedevguild7525 2 жыл бұрын
Hi Gregg, amazing video that shows how brute force transit into the ideal one hash pass solution. Greatly appreciate your effort to show the transition solution; two hash pass. To be honest, online solutions are mainly one hash pass, and it is harder to understand without showing two hash pass!
@taso9846
@taso9846 2 жыл бұрын
This is the best explanation I have seen. Please do more LeetCode problems!
@TheCodeCreative
@TheCodeCreative 2 жыл бұрын
Thanks Taso!
@aya2222
@aya2222 2 жыл бұрын
the best explanation for this problem!! Thank you so much! I hope you make more leetcode videos in future!!
@TheCodeCreative
@TheCodeCreative 2 жыл бұрын
More to come!
@thedevguild7525
@thedevguild7525 2 жыл бұрын
Hi Gregg, would like to seek your advice if possible on which is better for creating hashmap, object Vs Map?
@justcodingandwhatnot9890
@justcodingandwhatnot9890 2 жыл бұрын
Very helpful !! thank you kinda sir.
@TheCodeCreative
@TheCodeCreative 2 жыл бұрын
Thanks for watching!
@donniexl1033
@donniexl1033 2 жыл бұрын
Great explanation
@TheCodeCreative
@TheCodeCreative 2 жыл бұрын
👍🏻
@arunkaiser
@arunkaiser 3 жыл бұрын
Great 👏👍
@TheCodeCreative
@TheCodeCreative 3 жыл бұрын
Thank you! Cheers!
@TheCodeCreative
@TheCodeCreative 2 жыл бұрын
Download my FREE "Google Search Secrets for Developers" Cheat Sheet: store.thecodecreative.com/google-secrets-cheat-sheet
@Poohbify
@Poohbify Жыл бұрын
How do I find documentation on this If…in condition?
@Ashton-mx2bg
@Ashton-mx2bg 2 жыл бұрын
liked and subscribed, just started my coding journey
@TheCodeCreative
@TheCodeCreative 2 жыл бұрын
Excellent! What topics would you like to see a video on?
@Ashton-mx2bg
@Ashton-mx2bg 2 жыл бұрын
@@TheCodeCreative Currently on HTML, CSS, JavaScript with a hope of getting into react for this job! Anything and everything, I am just a sponge! Coding tips for noobs would be great! Its hard to judge progress as a new person
@TheCodeCreative
@TheCodeCreative 2 жыл бұрын
@@Ashton-mx2bg Awesome, good luck with your job search! I have a React playlist that might help: kzbin.info/aero/PLMPgoZdlPumfmIqtGdD0mvVVNLBMcdI5a
@miklos366
@miklos366 2 жыл бұрын
Hi Gregg, why do we need to change if(hashmap[complement]....) in the two pass hash soln ----> to if(complement in hashmap) in the one pass hash soln? Aren't both of it the same thing? if i use if(hashmap[complement]) in the one pass hash solution, I encounter an error. Would like to seek your advice.
@thedevguild7525
@thedevguild7525 2 жыл бұрын
If I am not wrong, the error could be due to falsy if you use hashmap[complement]. Let's await Gregg advice.
@praveengopu9325
@praveengopu9325 2 жыл бұрын
Hashmap[complement] gives undefined . In js undefined is false. (False is not equal to i) which is equal to true. The if statement will return undefined in the first run and not expected output
@TheCodeCreative
@TheCodeCreative 3 жыл бұрын
🗣JOIN the Code Creative Facebook group! : facebook.com/groups/1612600368887577
@mjrmls
@mjrmls 3 жыл бұрын
Hi Gregg, great videos. Could you cover ADSR enveloppes for a synth in the Web Audio API? Your videos have helped me a lot. Cheers
@TheCodeCreative
@TheCodeCreative 3 жыл бұрын
Thanks Major Miles! Yes, ADSR would be a great topic. I'll plan on covering that soon. 👍🏻
@whizzkee
@whizzkee Жыл бұрын
I wish this made sense
Drag and Drop JavaScript Tutorial - Getting Started - 1
15:10
The Code Creative
Рет қаралды 5 М.
JavaScript Sliding Window Technique - Fixed Size
15:19
The Code Creative
Рет қаралды 14 М.
Why Is He Unhappy…?
00:26
Alan Chikin Chow
Рет қаралды 73 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 30 МЛН
LeetCode Exercise in Java Tutorial - Two Sum FAST Solution
23:36
Coding with John
Рет қаралды 175 М.
How to reverse a Linked List in JavaScript
8:28
The Code Creative
Рет қаралды 12 М.
Whiteboard Coding Interviews: 6 Steps to Solve Any Problem
15:18
Fullstack Academy
Рет қаралды 364 М.
How To Solve Algorithms - Two Sum
6:56
Web Dev Simplified
Рет қаралды 80 М.
How Do Flex-Basis, Flex-Grow, Flex-Shrink Work? | CSS Flexbox
14:11
The Code Creative
Рет қаралды 9 М.
Map vs Object in JavaScript
14:33
Leigh Halliday
Рет қаралды 21 М.
541 Leetcode problems are NOT enough.
7:12
Sahil & Sarra
Рет қаралды 158 М.
Ba Travel Smart Phone Charger
0:42
Tech Official
Рет қаралды 1,2 МЛН
Это iPhone 16
0:52
Wylsacom
Рет қаралды 1,3 МЛН
low battery 🪫
0:10
dednahype
Рет қаралды 1,8 МЛН
Looks very comfortable. #leddisplay #ledscreen #ledwall #eagerled
0:19
LED Screen Factory-EagerLED
Рет қаралды 13 МЛН
Samsung laughing on iPhone #techbyakram
0:12
Tech by Akram
Рет қаралды 7 МЛН