mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 08:27:30 +08:00
48 lines
743 B
Go
48 lines
743 B
Go
package leetcode
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
type question59 struct {
|
|
para59
|
|
ans59
|
|
}
|
|
|
|
// para 是参数
|
|
// one 代表第一个参数
|
|
type para59 struct {
|
|
one int
|
|
}
|
|
|
|
// ans 是答案
|
|
// one 代表第一个答案
|
|
type ans59 struct {
|
|
one [][]int
|
|
}
|
|
|
|
func Test_Problem59(t *testing.T) {
|
|
|
|
qs := []question59{
|
|
|
|
{
|
|
para59{3},
|
|
ans59{[][]int{{1, 2, 3}, {8, 9, 4}, {7, 6, 5}}},
|
|
},
|
|
|
|
{
|
|
para59{4},
|
|
ans59{[][]int{{1, 2, 3, 4}, {12, 13, 14, 5}, {11, 16, 15, 6}, {10, 9, 8, 7}}},
|
|
},
|
|
}
|
|
|
|
fmt.Printf("------------------------Leetcode Problem 59------------------------\n")
|
|
|
|
for _, q := range qs {
|
|
_, p := q.ans59, q.para59
|
|
fmt.Printf("【input】:%v 【output】:%v\n", p, generateMatrix(p.one))
|
|
}
|
|
fmt.Printf("\n\n\n")
|
|
}
|