mirror of
https://github.com/SunnyQjm/algorithm-homework.git
synced 2026-10-05 01:15:36 +08:00
Update AlgorithmHomework1.md
This commit is contained in:
1 parent
b51d6cca9e
commit
44a5fa4c20
1 file changed
+4
-1
@@ -11,6 +11,7 @@
|
||||
用字典记录数字,以便在找到成对的另一个数的时候,可以快速的检索到前一个数的索引
|
||||
|
||||
- Leetcode提交结果
|
||||
|
||||

|
||||
- 代码:
|
||||
```python
|
||||
@@ -27,6 +28,7 @@
|
||||
- 算法思路:二分法
|
||||
|
||||
- Leetcode提交结果
|
||||
|
||||

|
||||
- 代码:
|
||||
```python
|
||||
@@ -50,6 +52,7 @@
|
||||
- 算法思路:动态规划。由于当前状态只取决于前两个状态,所以dp table可以精简为只用两个数表示
|
||||
|
||||
- Leetcode提交结果
|
||||
|
||||

|
||||
- 代码:
|
||||
```python
|
||||
@@ -58,4 +61,4 @@
|
||||
for i in range(1, n + 1):
|
||||
pre, cur = cur, pre + cur
|
||||
return cur
|
||||
```
|
||||
```
|
||||
Reference in new issue
Block a user