Sha256: d2eaf6b2836440cc800a06522787324d3f2133e0c1a44949dacf31a448685f8d

Contents?: true

Size: 258 Bytes

Versions: 118

Compression:

Stored size: 258 Bytes

Contents

package hamming

import "errors"

const testVersion = 6

func Distance(a, b string) (d int, err error) {
	if len(b) != len(a) {
		return 0, errors.New("strings of unequal length")
	}
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			d++
		}
	}
	return
}

Version data entries

118 entries across 118 versions & 1 rubygems

Version Path
trackler-2.2.1.56 tracks/go/exercises/hamming/example.go
trackler-2.2.1.55 tracks/go/exercises/hamming/example.go
trackler-2.2.1.54 tracks/go/exercises/hamming/example.go
trackler-2.2.1.53 tracks/go/exercises/hamming/example.go
trackler-2.2.1.52 tracks/go/exercises/hamming/example.go
trackler-2.2.1.51 tracks/go/exercises/hamming/example.go
trackler-2.2.1.50 tracks/go/exercises/hamming/example.go
trackler-2.2.1.49 tracks/go/exercises/hamming/example.go
trackler-2.2.1.48 tracks/go/exercises/hamming/example.go
trackler-2.2.1.47 tracks/go/exercises/hamming/example.go
trackler-2.2.1.46 tracks/go/exercises/hamming/example.go
trackler-2.2.1.45 tracks/go/exercises/hamming/example.go
trackler-2.2.1.44 tracks/go/exercises/hamming/example.go
trackler-2.2.1.43 tracks/go/exercises/hamming/example.go
trackler-2.2.1.42 tracks/go/exercises/hamming/example.go
trackler-2.2.1.41 tracks/go/exercises/hamming/example.go
trackler-2.2.1.40 tracks/go/exercises/hamming/example.go
trackler-2.2.1.39 tracks/go/exercises/hamming/example.go
trackler-2.2.1.38 tracks/go/exercises/hamming/example.go
trackler-2.2.1.37 tracks/go/exercises/hamming/example.go