Skip to content

Instantly share code, notes, and snippets.

@melkael
Created February 1, 2019 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melkael/cad64b246e8ed51eabae3b120f2a4221 to your computer and use it in GitHub Desktop.
Save melkael/cad64b246e8ed51eabae3b120f2a4221 to your computer and use it in GitHub Desktop.
func countDuplicates(elem [10][]byte) int {
tmp := elem
ret := 0
for i := range tmp {
for j := range elem {
if i != j && reflect.DeepEqual(tmp[i], elem[j]) {
ret++
}
}
}
return ret
}
func main() {
f, _ := os.Open("8.txt")
fs := bufio.NewScanner(f)
for fs.Scan() {
txt := fs.Text()
e := strToBlockArray(txt)
if countDuplicates(e) != 0 {
fmt.Println("Challenge 8,the encoded block is :", txt)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment