diff --git a/src/main/kotlin/p30xx/Problem3019.kt b/src/main/kotlin/p30xx/Problem3019.kt new file mode 100644 index 00000000..534e4d0a --- /dev/null +++ b/src/main/kotlin/p30xx/Problem3019.kt @@ -0,0 +1,21 @@ +package p30xx + +import util.expect + +fun main() { + class Solution { + fun countKeyChanges(s: String): Int { + val set = setOf(0, 'A' - 'a', 'a' - 'A') + + return (1 until s.length).count { + s[it] - s[it - 1] !in set + } + } + } + + expect { + Solution().countKeyChanges( + "" + ) + } +}