Matej Focko
bddc4f48dd
URL: https://leetcode.com/problems/minimum-number-of-changes-to-make-binary-string-beautiful/ Signed-off-by: Matej Focko <me@mfocko.xyz>
6 lines
140 B
Kotlin
6 lines
140 B
Kotlin
class Solution {
|
|
fun minChanges(s: String): Int =
|
|
s.chunked(2).map {
|
|
if (it[0] != it[1]) 1 else 0
|
|
}.sum()
|
|
}
|