Skip to content

Commit 3809df8

Browse files
authored
Create Number of Changing Keys.java
1 parent 3291f2e commit 3809df8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Easy/Number of Changing Keys.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public int countKeyChanges(String s) {
3+
int changes = 0;
4+
for (int i = 1; i < s.length(); i++) {
5+
if (Character.toLowerCase(s.charAt(i)) != Character.toLowerCase(s.charAt(i - 1))) {
6+
changes++;
7+
}
8+
}
9+
return changes;
10+
}
11+
}

0 commit comments

Comments
 (0)