mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
58 lines
795 B
Go
58 lines
795 B
Go
package leetcode
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
type question242 struct {
|
|
para242
|
|
ans242
|
|
}
|
|
|
|
// para 是参数
|
|
// one 代表第一个参数
|
|
type para242 struct {
|
|
one string
|
|
two string
|
|
}
|
|
|
|
// ans 是答案
|
|
// one 代表第一个答案
|
|
type ans242 struct {
|
|
one bool
|
|
}
|
|
|
|
func Test_Problem242(t *testing.T) {
|
|
|
|
qs := []question242{
|
|
|
|
{
|
|
para242{"", ""},
|
|
ans242{true},
|
|
},
|
|
{
|
|
para242{"", "1"},
|
|
ans242{false},
|
|
},
|
|
|
|
{
|
|
para242{"anagram", "nagaram"},
|
|
ans242{true},
|
|
},
|
|
|
|
{
|
|
para242{"rat", "car"},
|
|
ans242{false},
|
|
},
|
|
}
|
|
|
|
fmt.Printf("------------------------Leetcode Problem 242------------------------\n")
|
|
|
|
for _, q := range qs {
|
|
_, p := q.ans242, q.para242
|
|
fmt.Printf("【input】:%v 【output】:%v\n", p, isAnagram(p.one, p.two))
|
|
}
|
|
fmt.Printf("\n\n\n")
|
|
}
|