update 0322.零钱兑换:添加复杂度分析
This commit is contained in:
parent
84b84e5bf1
commit
9fef5cbd00
|
|
@ -133,6 +133,11 @@ public:
|
|||
};
|
||||
```
|
||||
|
||||
* 时间复杂度: O(n * amount),其中 n 为 coins 的长度
|
||||
* 空间复杂度: O(amount)
|
||||
|
||||
|
||||
|
||||
对于遍历方式遍历背包放在外循环,遍历物品放在内循环也是可以的,我就直接给出代码了
|
||||
|
||||
```CPP
|
||||
|
|
@ -154,6 +159,8 @@ public:
|
|||
}
|
||||
};
|
||||
```
|
||||
* 同上
|
||||
|
||||
|
||||
## 总结
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue