1. Listen
2. Example
3. Brute Force
4. Optimize (BUD)
5. Walk Through
6. Implement
7. Tests
---
2 sums
In a array return the indexes, which sum is T
Z, not sorted, no duplicate, only 1, if no then empty/null
---
Yu
1. Listen
1. N or Z, Sorted or not, duplicate, only 1 answer
2. [n,n,n,], 0
3. 兩兩排列組合,交換率減少重複
4. 當前的數必定有一對應差值,我們將其記憶下來,一旦出現對應差值時則必有解,唯獨解不是差值而是相對應的 index,所以必須要有 mapping 的表
5. walk through
```
when visit a index
if I know the element of index is a some diff number
then the result is the mapping index and current index
else I memerize the diff n and mapping its index.
```
map d
7.
---
Louis
1. If no sum is T, then?
2. Example
[1,2,3], 4 -> [0,2]
[...,-1, 2, 5, 6...], 4 -> [0,2]
[1...9999], 4
[1,2,9999], 4
[1,1,2,2], 4
[], 0
[1,3,2,2], 4
3. Brute
- 每個東西兩兩相加,如果是 target 就得到答案。
---
Allen
3. Complexity
Time: O(n^2)
Space: O(1)
5. Walk Through