kt: add «2914. Minimum Number of Changes to Make Binary String Beautiful»
URL: https://leetcode.com/problems/minimum-number-of-changes-to-make-binary-string-beautiful/ Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
383579f508
commit
bddc4f48dd
1 changed files with 6 additions and 0 deletions
|
@ -0,0 +1,6 @@
|
|||
class Solution {
|
||||
fun minChanges(s: String): Int =
|
||||
s.chunked(2).map {
|
||||
if (it[0] != it[1]) 1 else 0
|
||||
}.sum()
|
||||
}
|
Loading…
Reference in a new issue