mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
add: leetcode 0400 test
This commit is contained in:
45
leetcode/0400.Nth-Digit/400.Nth Digit_test.go
Normal file
45
leetcode/0400.Nth-Digit/400.Nth Digit_test.go
Normal file
@ -0,0 +1,45 @@
|
||||
package leetcode
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type question400 struct {
|
||||
para400
|
||||
ans400
|
||||
}
|
||||
|
||||
// para 是参数
|
||||
type para400 struct {
|
||||
n int
|
||||
}
|
||||
|
||||
// ans 是答案
|
||||
type ans400 struct {
|
||||
ans int
|
||||
}
|
||||
|
||||
func Test_Problem400(t *testing.T) {
|
||||
|
||||
qs := []question400{
|
||||
|
||||
{
|
||||
para400{3},
|
||||
ans400{3},
|
||||
},
|
||||
|
||||
{
|
||||
para400{11},
|
||||
ans400{0},
|
||||
},
|
||||
}
|
||||
|
||||
fmt.Printf("------------------------Leetcode Problem 400------------------------\n")
|
||||
|
||||
for _, q := range qs {
|
||||
_, p := q.ans400, q.para400
|
||||
fmt.Printf("【input】:%v 【output】:%v\n", p.n, findNthDigit(p.n))
|
||||
}
|
||||
fmt.Printf("\n\n\n")
|
||||
}
|
Reference in New Issue
Block a user