Files
hello-algo/ja/codes/go/chapter_dynamic_programming/coin_change_test.go
T
Yudong Jin 7257641e0e Retranslate the complete Japanese online edition from Chinese (#2008)
* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
2026-10-30 02:12:26 +08:00

24 lines
548 B
Go

// File: coin_change_test.go
// Created Time: 2023-07-23
// Author: Reanon ([email protected])
package chapter_dynamic_programming
import (
"fmt"
"testing"
)
func TestCoinChange(t *testing.T) {
coins := []int{1, 2, 5}
amt := 4
// 動的計画法
res := coinChangeDP(coins, amt)
fmt.Printf("目標金額にするために必要な硬貨の最小枚数は %d\n", res)
// 空間を最適化した動的計画法
res = coinChangeDPComp(coins, amt)
fmt.Printf("目標金額にするために必要な硬貨の最小枚数は %d\n", res)
}