Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions solution/3000-3099/3019.Number of Changing Keys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tags:
<pre>
<strong>输入:</strong>s = "aAbBcC"
<strong>输出:</strong>2
<strong>解释:</strong>
<strong>解释:</strong>
从 s[0] = 'a' 到 s[1] = 'A',不存在按键变更,因为不计入 caps lock 或 shift 。
从 s[1] = 'A' 到 s[2] = 'b',按键变更。
从 s[2] = 'b' 到 s[3] = 'B',不存在按键变更,因为不计入 caps lock 或 shift 。
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions solution/3000-3099/3019.Number of Changing Keys/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ tags:
<pre>
<strong>Input:</strong> s = &quot;aAbBcC&quot;
<strong>Output:</strong> 2
<strong>Explanation:</strong>
<strong>Explanation:</strong>
From s[0] = &#39;a&#39; to s[1] = &#39;A&#39;, there is no change of key as caps lock or shift is not counted.
From s[1] = &#39;A&#39; to s[2] = &#39;b&#39;, there is a change of key.
From s[2] = &#39;b&#39; to s[3] = &#39;B&#39;, there is no change of key as caps lock or shift is not counted.
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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()))
Loading