mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-08 13:36:06 +00:00
2778a6f9c7
* Review the EN heading format. * Fix pythontutor headings. * Fix pythontutor headings. * bug fixes * Fix headings in **/summary.md * Revisit the CN-to-EN translation for Python code using Claude-4.5 * Revisit the CN-to-EN translation for Java code using Claude-4.5 * Revisit the CN-to-EN translation for Cpp code using Claude-4.5. * Fix the dictionary. * Fix cpp code translation for the multipart strings. * Translate Go code to English. * Update workflows to test EN code. * Add EN translation for C. * Add EN translation for CSharp. * Add EN translation for Swift. * Trigger the CI check. * Revert. * Update en/hash_map.md * Add the EN version of Dart code. * Add the EN version of Kotlin code. * Add missing code files. * Add the EN version of JavaScript code. * Add the EN version of TypeScript code. * Fix the workflows. * Add the EN version of Ruby code. * Add the EN version of Rust code. * Update the CI check for the English version code. * Update Python CI check. * Fix cmakelists for en/C code. * Fix Ruby comments
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
// File: climbing_stairs_test.go
|
|
// Created Time: 2023-07-18
|
|
// Author: Reanon (793584285@qq.com)
|
|
|
|
package chapter_dynamic_programming
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestClimbingStairsBacktrack(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsBacktrack(n)
|
|
fmt.Printf("Climbing %d stairs has %d solutions\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsDFS(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsDFS(n)
|
|
fmt.Printf("Climbing %d stairs has %d solutions\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsDFSMem(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsDFSMem(n)
|
|
fmt.Printf("Climbing %d stairs has %d solutions\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsDP(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsDP(n)
|
|
fmt.Printf("Climbing %d stairs has %d solutions\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsDPComp(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsDPComp(n)
|
|
fmt.Printf("Climbing %d stairs has %d solutions\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsConstraintDP(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsConstraintDP(n)
|
|
fmt.Printf("Climbing %d stairs has %d solutions\n", n, res)
|
|
}
|
|
|
|
func TestMinCostClimbingStairsDPComp(t *testing.T) {
|
|
cost := []int{0, 1, 10, 1, 1, 1, 10, 1, 1, 10, 1}
|
|
fmt.Printf("Input stair cost list is %v\n", cost)
|
|
|
|
res := minCostClimbingStairsDP(cost)
|
|
fmt.Printf("Minimum cost to climb stairs is %d\n", res)
|
|
|
|
res = minCostClimbingStairsDPComp(cost)
|
|
fmt.Printf("Minimum cost to climb stairs is %d\n", res)
|
|
}
|