Two Sum | LeetCode 1 | JavaScript | Easy

Опубликовано: 09 Октябрь 2023
на канале: Gordon Zhu
10,549
539

In painstaking detail, I go through my entire thought process for solving Two Sum from first principles. We'll start with the essential insights that lead us to the brute-force solution. From there, we'll optimize to get various performant O(n) time approaches. Finally, we'll discuss the pros/cons of our performant approaches.

My teaching work: https://watchandcode.com
Two sum problem: https://leetcode.com/problems/two-sum/

0:00 Two sum problem statement
0:21 Initial thought process
1:14 Brute-force implementation & analysis
3:03 Optimizing our initial approach
7:28 Implementing a faster algorithm
7:50 What about the one-pass approach?
8:20 Coming up with the one-pass
9:55 Why the one-pass is so awkward
12:03 The most important part


Смотрите видео Two Sum | LeetCode 1 | JavaScript | Easy онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Gordon Zhu 09 Октябрь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 10,549 раз и оно понравилось 539 людям.