diff --git a/solution/3000-3099/3019.Number of Changing Keys/README.md b/solution/3000-3099/3019.Number of Changing Keys/README.md index 6398be4e58991..065a79f073985 100644 --- a/solution/3000-3099/3019.Number of Changing Keys/README.md +++ b/solution/3000-3099/3019.Number of Changing Keys/README.md @@ -31,7 +31,7 @@ tags:
输入:s = "aAbBcC"
输出:2
-解释:
+解释:
从 s[0] = 'a' 到 s[1] = 'A',不存在按键变更,因为不计入 caps lock 或 shift 。
从 s[1] = 'A' 到 s[2] = 'b',按键变更。
从 s[2] = 'b' 到 s[3] = 'B',不存在按键变更,因为不计入 caps lock 或 shift 。
@@ -75,7 +75,7 @@ tags:
```python
class Solution:
def countKeyChanges(self, s: str) -> int:
- return sum(a.lower() != b.lower() for a, b in pairwise(s))
+ return sum(a != b for a, b in pairwise(s.lower()))
```
#### Java
diff --git a/solution/3000-3099/3019.Number of Changing Keys/README_EN.md b/solution/3000-3099/3019.Number of Changing Keys/README_EN.md
index ca7144d2a990f..40d4ccdb81352 100644
--- a/solution/3000-3099/3019.Number of Changing Keys/README_EN.md
+++ b/solution/3000-3099/3019.Number of Changing Keys/README_EN.md
@@ -30,7 +30,7 @@ tags:
Input: s = "aAbBcC"
Output: 2
-Explanation:
+Explanation:
From s[0] = 'a' to s[1] = 'A', there is no change of key as caps lock or shift is not counted.
From s[1] = 'A' to s[2] = 'b', there is a change of key.
From s[2] = 'b' to s[3] = 'B', there is no change of key as caps lock or shift is not counted.
@@ -74,7 +74,7 @@ The time complexity is $O(n)$, where $n$ is the length of the string $s$. The sp
```python
class Solution:
def countKeyChanges(self, s: str) -> int:
- return sum(a.lower() != b.lower() for a, b in pairwise(s))
+ return sum(a != b for a, b in pairwise(s.lower()))
```
#### Java
diff --git a/solution/3000-3099/3019.Number of Changing Keys/Solution.py b/solution/3000-3099/3019.Number of Changing Keys/Solution.py
index bce74393a5ed6..61b3f0d8b0499 100644
--- a/solution/3000-3099/3019.Number of Changing Keys/Solution.py
+++ b/solution/3000-3099/3019.Number of Changing Keys/Solution.py
@@ -1,3 +1,3 @@
class Solution:
def countKeyChanges(self, s: str) -> int:
- return sum(a.lower() != b.lower() for a, b in pairwise(s))
+ return sum(a != b for a, b in pairwise(s.lower()))