mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-01 10:45:21 +08:00
* feat(ko): add the complete Korean online edition * Use UTF-8 for Python CI output on Windows * Remove print-book promotion from the Korean site * fix(ko): preserve emphasis before Korean particles
24 lines
563 B
Go
24 lines
563 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)
|
|
}
|