Two Sum - LeetCode 1 - Python

preview_player
Показать описание
Most teachers introduce solutions as fully-formed recipes. But in doing so, they totally miss how solutions are DISCOVERED. In painstaking detail, I go through this crucial missing piece and demonstrate how to methodically attack problems from every possible angle.

My video for Two Sum II (the sequel to this problem):

0:00 Two sum problem statement
0:19 Initial thought process
1:12 Brute-force implementation & analysis
3:00 Optimizing our initial approach
7:25 Implementing a faster algorithm
7:47 One-pass?
9:52 Awkward code
12:00 The most important part
Рекомендации по теме
Комментарии
Автор

I am deeply impressed by your use of pen and paper, even the clever little slider. Pen and paper is what helps me the most with thinking about programming.

catocall
Автор

This is such nugget of gold! You've explained everything soo well, keep it coming!!

rohinv
Автор

The question said "you may assume each input has exactly one solution"
Hence the solution either has no number repeated in the array, or the solution is a repeated number in 2 indices.

IdrisIdris-xqki