Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
isaiahliu committed Jan 9, 2025
1 parent 3371135 commit 1ace1e4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/kotlin/p30xx/Problem3019.kt
Original file line number Diff line number Diff line change
@@ -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(
""
)
}
}

0 comments on commit 1ace1e4

Please sign in to comment.