Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add: leetcode 0014 test
  • Loading branch information
tphyhFighting committed Nov 19, 2021
commit 179ac20a836f6a5f759e429a70362ce5c46f14bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package leetcode

import (
"fmt"
"testing"
)

type question14 struct {
para14
ans14
}

// para 是参数
type para14 struct {
strs []string
}

// ans 是答案
type ans14 struct {
ans string
}

func Test_Problem14(t *testing.T) {

qs := []question14{

{
para14{[]string{"flower", "flow", "flight"}},
ans14{"fl"},
},

{
para14{[]string{"dog", "racecar", "car"}},
ans14{""},
},
}

fmt.Printf("------------------------Leetcode Problem 14------------------------\n")

for _, q := range qs {
_, p := q.ans14, q.para14
fmt.Printf("【input】:%v 【output】:%v\n", p.strs, longestCommonPrefix(p.strs))
}
fmt.Printf("\n\n\n")
}