update 0322.零钱兑换:添加复杂度分析

This commit is contained in:
Yuhao Ju 2023-04-11 11:51:41 +08:00 committed by GitHub
parent 84b84e5bf1
commit 9fef5cbd00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -133,6 +133,11 @@ public:
};
```
* 时间复杂度: O(n * amount),其中 n 为 coins 的长度
* 空间复杂度: O(amount)
对于遍历方式遍历背包放在外循环,遍历物品放在内循环也是可以的,我就直接给出代码了
```CPP
@ -154,6 +159,8 @@ public:
}
};
```
* 同上
## 总结