all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
21
Task/Symmetric-difference/Go/symmetric-difference-1.go
Normal file
21
Task/Symmetric-difference/Go/symmetric-difference-1.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
var a = map[string]bool{"John": true, "Bob": true, "Mary": true, "Serena": true}
|
||||
var b = map[string]bool{"Jim": true, "Mary": true, "John": true, "Bob": true}
|
||||
|
||||
func main() {
|
||||
sd := make(map[string]bool)
|
||||
for e := range a {
|
||||
if !b[e] {
|
||||
sd[e] = true
|
||||
}
|
||||
}
|
||||
for e := range b {
|
||||
if !a[e] {
|
||||
sd[e] = true
|
||||
}
|
||||
}
|
||||
fmt.Println(sd)
|
||||
}
|
||||
6
Task/Symmetric-difference/Go/symmetric-difference-2.go
Normal file
6
Task/Symmetric-difference/Go/symmetric-difference-2.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
func main() {
|
||||
for e := range b {
|
||||
delete(a, e)
|
||||
}
|
||||
fmt.Println(a)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue