I solved Sales by Match problem in this way:
package main
import (
"fmt"
)
func main() {
var amount int
_, _ = fmt.Scanf("%d", &amount)
pairs := 0
set := make(map[int]bool)
for i := 0; i < amount; i++ {
var number int
_, _ = fmt.Scanf("%d", &number)
if set[number] {
set[number] = false
pairs++
} else {
set[number] = true
}
}
println(pairs)
}
I tested it with the following input:
9 10 20 20 10 10 30 50 10 20
Here's the result:
So, as you can see, everything works fine. But when I run the tests I see the following result:
I don't understand why they are not passed, so, please, can anyone explain what's the problem in my solution? Thanks in advance I would appreciate any help