From 52033af3dc29e2dd0b56742c59084ec4045412fa Mon Sep 17 00:00:00 2001
From: CyC2018 <1029579233@qq.com>
Date: Sat, 17 Mar 2018 14:43:21 +0800
Subject: [PATCH] auto commit
---
notes/Redis.md | 2 ++
notes/剑指 offer 题解.md | 11 +++++++++++
pics/080f488c-75ef-49a8-a49d-78fa372ad422.png | Bin 0 -> 8192 bytes
3 files changed, 13 insertions(+)
create mode 100644 pics/080f488c-75ef-49a8-a49d-78fa372ad422.png
diff --git a/notes/Redis.md b/notes/Redis.md
index 82373006..3f76efb1 100644
--- a/notes/Redis.md
+++ b/notes/Redis.md
@@ -70,6 +70,8 @@ OK
+
+
```html
> rpush list-key item
(integer) 1
diff --git a/notes/剑指 offer 题解.md b/notes/剑指 offer 题解.md
index 29952f2f..9c3177b3 100644
--- a/notes/剑指 offer 题解.md
+++ b/notes/剑指 offer 题解.md
@@ -97,6 +97,7 @@
- begin, end 表示左闭右开区间:[begin, end);
- l, h 表示二分查找的闭区间:[l, h];
- ret 表示结果相关的变量;
+- dp 表示动态规划保存子问题的数组;
**复杂度简写说明**
@@ -435,6 +436,16 @@ public int pop() {
以 O(1) 的时间复杂度求菲波那切数列。
+
+
+**解题思路**
+
+如果使用递归求解,那么会重复计算一些子问题。例如,求 f(10) 需要计算 f(9) 和 f(8),计算 f(9) 需要计算 f(8) 和 f(7),可以看到 f(8) 被重复计算了。
+
+
+
+递归方法是将一个问题划分成多个子问题求解,动态规划也是如此,但是动态规划会把子问题的解缓存起来,避免重复求解子问题。
+
```java
public class Solution {
private int[] fib = new int[40];
diff --git a/pics/080f488c-75ef-49a8-a49d-78fa372ad422.png b/pics/080f488c-75ef-49a8-a49d-78fa372ad422.png
new file mode 100644
index 0000000000000000000000000000000000000000..c40ea2d20231aa20bd4379aa592be50e86568ea5
GIT binary patch
literal 8192
zcmeHsc{G%7952};TTIpnlWnH5?_14SX0m6SnIh{j1|iwWQW&zt2%*LvLl_fT%a*l9
z7)C{+Q1eTLLUP}JzjM#I|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