|
@@ -0,0 +1,20 @@
|
|
|
+func findDuplicate(paths []string) [][]string {
|
|
|
+ res := make([][]string, 0)
|
|
|
+ m := make(map[string]int)
|
|
|
+ idx := 0
|
|
|
+ for _, path := range paths {
|
|
|
+ strs := strings.Split(path, " ")
|
|
|
+ for i := 1; i < len(strs); i++ {
|
|
|
+ names := strings.Split(strs[i], "(")
|
|
|
+ file := strs[0] + "/" + names[0]
|
|
|
+ if v, ok := m[names[1]]; ok {
|
|
|
+ res[v] = append(res[v], file)
|
|
|
+ } else {
|
|
|
+ res = append(res, []string{file})
|
|
|
+ m[names[1]] = idx
|
|
|
+ idx++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res
|
|
|
+}
|