You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: solution/3000-3099/3019.Number of Changing Keys/README_EN.md
+33-23
Original file line number
Diff line number
Diff line change
@@ -43,28 +43,30 @@ From s[4] = 'c' to s[5] = 'C', there is no change of key as caps
43
43
44
44
## Solutions
45
45
46
-
### Solution 1
46
+
### Solution 1: Single Pass
47
+
48
+
We can traverse the string, each time checking whether the lowercase form of the current character is the same as the lowercase form of the previous character. If they are different, it means that the key has been changed, and we can increment the answer accordingly.
49
+
50
+
The time complexity is $O(n)$, where $n$ is the length of the string $s$. The space complexity is $O(1)$.
0 commit comments