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: watchandcode.com
Two sum problem: 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
Пікірлер: 35