hello-algo/codes/go/chapter_backtracking/permutation_test.go
Reanon a6b3f72826
feat(go/backtracking): add go code (#488)
* feat(go/backtracking): add go code

* feat(backtracking): add n_queens in go

* feat(backtracking): add /preorder_traversal_i_compact in go

* feat(backtracking): add /preorder_traversal_ii_compact in go

* feat(backtracking): add /preorder_traversal_ii_template in go

* feat(backtracking): add preorder_traversal_iii_compact in go

* feat(backtracking): add preorder_traversal_test in go

* feat(backtracking): add permutations_i in go

* feat(backtracking): add permutations_ii in go

* feat(backtracking): add permutation_test in go

* feat(backtracking): fix bug in go

* Update permutations_i.go

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-05-15 01:17:42 +08:00

33 lines
634 B
Go

// File: preorder_traversal_i_compact_test.go
// Created Time: 2023-05-09
// Author: Reanon (793584285@qq.com)
package chapter_backtracking
import (
"fmt"
"testing"
. "github.com/krahets/hello-algo/pkg"
)
func TestPermutationI(t *testing.T) {
/* 全排列 I */
nums := []int{1, 2, 3}
fmt.Printf("输入数组 nums = ")
PrintSlice(nums)
res := permutationsI(nums)
fmt.Printf("所有排列 res = ")
fmt.Println(res)
}
func TestPermutationII(t *testing.T) {
nums := []int{1, 2, 2}
fmt.Printf("输入数组 nums = ")
PrintSlice(nums)
res := permutationsII(nums)
fmt.Printf("所有排列 res = ")
fmt.Println(res)
}