diff --git a/kt/minimum-number-of-changes-to-make-binary-string-beautiful.kt b/kt/minimum-number-of-changes-to-make-binary-string-beautiful.kt new file mode 100644 index 0000000..adaf36e --- /dev/null +++ b/kt/minimum-number-of-changes-to-make-binary-string-beautiful.kt @@ -0,0 +1,6 @@ +class Solution { + fun minChanges(s: String): Int = + s.chunked(2).map { + if (it[0] != it[1]) 1 else 0 + }.sum() +}