From ae7fd87fc0d7b48de67b2743dad033eeef0a3cc1 Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Mon, 2 Nov 2020 00:58:34 +0800 Subject: [PATCH] auto commit --- docs/notes/Leetcode 题解 - 动态规划.md | 1 + notes/Leetcode 题解 - 动态规划.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/notes/Leetcode 题解 - 动态规划.md b/docs/notes/Leetcode 题解 - 动态规划.md index 305174be..df64fe3d 100644 --- a/docs/notes/Leetcode 题解 - 动态规划.md +++ b/docs/notes/Leetcode 题解 - 动态规划.md @@ -912,6 +912,7 @@ return -1. ```java public int coinChange(int[] coins, int amount) { + if (amount == 0 || coins == null) return 0; int[] dp = new int[amount + 1]; for (int coin : coins) { for (int i = coin; i <= amount; i++) { //将逆序遍历改为正序遍历 diff --git a/notes/Leetcode 题解 - 动态规划.md b/notes/Leetcode 题解 - 动态规划.md index 305174be..df64fe3d 100644 --- a/notes/Leetcode 题解 - 动态规划.md +++ b/notes/Leetcode 题解 - 动态规划.md @@ -912,6 +912,7 @@ return -1. ```java public int coinChange(int[] coins, int amount) { + if (amount == 0 || coins == null) return 0; int[] dp = new int[amount + 1]; for (int coin : coins) { for (int i = coin; i <= amount; i++) { //将逆序遍历改为正序遍历