mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
78 lines
980 B
Go
78 lines
980 B
Go
package leetcode
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
type question71 struct {
|
|
para71
|
|
ans71
|
|
}
|
|
|
|
// para 是参数
|
|
// one 代表第一个参数
|
|
type para71 struct {
|
|
s string
|
|
}
|
|
|
|
// ans 是答案
|
|
// one 代表第一个答案
|
|
type ans71 struct {
|
|
one string
|
|
}
|
|
|
|
func Test_Problem71(t *testing.T) {
|
|
|
|
qs := []question71{
|
|
|
|
{
|
|
para71{"/.hidden"},
|
|
ans71{"/.hidden"},
|
|
},
|
|
|
|
{
|
|
para71{"/..hidden"},
|
|
ans71{"/..hidden"},
|
|
},
|
|
|
|
{
|
|
para71{"/abc/..."},
|
|
ans71{"/abc/..."},
|
|
},
|
|
|
|
{
|
|
para71{"/home/"},
|
|
ans71{"/home"},
|
|
},
|
|
|
|
{
|
|
para71{"/..."},
|
|
ans71{"/..."},
|
|
},
|
|
|
|
{
|
|
para71{"/../"},
|
|
ans71{"/"},
|
|
},
|
|
|
|
{
|
|
para71{"/home//foo/"},
|
|
ans71{"/home/foo"},
|
|
},
|
|
|
|
{
|
|
para71{"/a/./b/../../c/"},
|
|
ans71{"/c"},
|
|
},
|
|
}
|
|
|
|
fmt.Printf("------------------------Leetcode Problem 71------------------------\n")
|
|
|
|
for _, q := range qs {
|
|
_, p := q.ans71, q.para71
|
|
fmt.Printf("【input】:%v 【output】:%v\n", p, simplifyPath(p.s))
|
|
}
|
|
fmt.Printf("\n\n\n")
|
|
}
|