mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
规范格式
This commit is contained in:
58
leetcode/0143.Reorder-List/143. Reorder List_test.go
Normal file
58
leetcode/0143.Reorder-List/143. Reorder List_test.go
Normal file
@ -0,0 +1,58 @@
|
||||
package leetcode
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/halfrost/LeetCode-Go/structures"
|
||||
)
|
||||
|
||||
type question143 struct {
|
||||
para143
|
||||
ans143
|
||||
}
|
||||
|
||||
// para 是参数
|
||||
// one 代表第一个参数
|
||||
type para143 struct {
|
||||
one []int
|
||||
}
|
||||
|
||||
// ans 是答案
|
||||
// one 代表第一个答案
|
||||
type ans143 struct {
|
||||
one []int
|
||||
}
|
||||
|
||||
func Test_Problem143(t *testing.T) {
|
||||
|
||||
qs := []question143{
|
||||
|
||||
question143{
|
||||
para143{[]int{1, 2, 3, 4, 5}},
|
||||
ans143{[]int{1, 5, 2, 4, 3}},
|
||||
},
|
||||
question143{
|
||||
para143{[]int{1, 2, 3, 4}},
|
||||
ans143{[]int{1, 4, 2, 3}},
|
||||
},
|
||||
|
||||
question143{
|
||||
para143{[]int{1}},
|
||||
ans143{[]int{1}},
|
||||
},
|
||||
|
||||
question143{
|
||||
para143{[]int{}},
|
||||
ans143{[]int{}},
|
||||
},
|
||||
}
|
||||
|
||||
fmt.Printf("------------------------Leetcode Problem 143------------------------\n")
|
||||
|
||||
for _, q := range qs {
|
||||
_, p := q.ans143, q.para143
|
||||
fmt.Printf("【input】:%v 【output】:%v\n", p, structures.List2Ints(reorderList(structures.Ints2List(p.one))))
|
||||
}
|
||||
fmt.Printf("\n\n\n")
|
||||
}
|
Reference in New Issue
Block a user