MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / coinChangeTopDown

Function coinChangeTopDown

coin_change_322/solution.go:72–77  ·  view source on GitHub ↗

Version 1: Top-down approach using recursion

(coins []int, amount int)

Source from the content-addressed store, hash-verified

70
71// Version 1: Top-down approach using recursion
72func coinChangeTopDown(coins []int, amount int) int {
73 if len(coins) == 0 || amount < 1 {
74 return -1
75 }
76 return minChange(coins, amount, make([]int, amount))
77}
78
79func minChange(coins []int, rem int, memo []int) int {
80 if rem < 0 {

Callers

nothing calls this directly

Calls 1

minChangeFunction · 0.85

Tested by

no test coverage detected