mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-06-02 14:02:39 +08:00
fix: cascading sharing problems
This commit is contained in:
@@ -161,3 +161,21 @@ func Merge(a, b SSortedStrings) SSortedStrings {
|
||||
}
|
||||
return SSortedStrings(ret)
|
||||
}
|
||||
|
||||
func Intersect(a, b SSortedStrings) SSortedStrings {
|
||||
ret := make([]string, 0)
|
||||
i := 0
|
||||
j := 0
|
||||
for i < len(a) && j < len(b) {
|
||||
if a[i] == b[j] {
|
||||
ret = append(ret, a[i])
|
||||
i += 1
|
||||
j += 1
|
||||
} else if a[i] < b[j] {
|
||||
i += 1
|
||||
} else if a[i] > b[j] {
|
||||
j += 1
|
||||
}
|
||||
}
|
||||
return SSortedStrings(ret)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user