Skip to content

docs: add a description of the solution to lc problem: No.1414 #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@

<!-- 这里可写通用的实现逻辑 -->

由于斐波那契数特点,数字重用在此题中是一个烟雾弹。举例推导:`k = 288`,数列(局部)`1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377`,可以由两个 144,或 `233 + 55` 组成;`k = 10`,可以由两个 5 或 `8 + 2` 组成。

由此可以使用贪心策略,逆向遍历斐波那契数列,进行暴力查找:

```txt
FIND-MIN-FIBONACCI-NUMBERS(k)
r = 0
for n in f
if k >= n
k -= n
r++
if k === 0
return res
```

<!-- tabs:start -->

### **Python3**
Expand Down