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.1.0.55 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.54 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.53 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.52 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.51 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.50 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.49 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.48 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.47 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.46 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.45 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.44 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.43 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.42 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.41 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.40 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.39 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.38 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.37 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt
trackler-2.1.0.36 tracks/kotlin/exercises/hamming/src/example/kotlin/Hamming.kt