Sha256: 1bd546800c5fbc4fa9ab15660ac18bb8aa22f7e45656457b77016d647d17e0f6

Contents?: true

Size: 318 Bytes

Versions: 270

Compression:

Stored size: 318 Bytes

Contents

object Hamming {

    fun compute(leftStrand: String, rightStrand: String): Int {
        require(leftStrand.length == rightStrand.length, {"leftStrand and rightStrand must be of equal length."})

        val commonPairs = leftStrand.zip(rightStrand)
        return commonPairs.count { it.first != it.second }
    }
}

Version data entries

270 entries across 270 versions & 1 rubygems

Version Path
trackler-2.2.1.52 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.51 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.50 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.49 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.48 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.47 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.46 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.45 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.44 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.43 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.42 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.41 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.40 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.39 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.38 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.37 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.36 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.35 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.34 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt
trackler-2.2.1.33 tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt