feat: add Permutation and Combination

This commit is contained in:
dudaodong committed 2024-11-19 10:12:07 +08:00
1 parent 8322951475
commit 95a894e53f
3 files changed
+108 -6

No files matched your search

+24
View File
@@ -502,3 +502,27 @@ func ExampleStdDev() {
// 1.41
// 1.55
}
func ExamplePermutation() {
result1 := Permutation(5, 3)
result2 := Permutation(5, 5)
fmt.Println(result1)
fmt.Println(result2)
// Output:
// 60
// 120
}
func ExampleCombination() {
result1 := Combination(5, 3)
result2 := Combination(5, 5)
fmt.Println(result1)
fmt.Println(result2)
// Output:
// 10
// 1
}