Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 16116c4

Browse files
authored
perf: update python solution to lc problem: No.3019 (doocs#3936)
1 parent 443c0ec commit 16116c4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

solution/3000-3099/3019.Number of Changing Keys/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ tags:
3131
<pre>
3232
<strong>输入:</strong>s = "aAbBcC"
3333
<strong>输出:</strong>2
34-
<strong>解释:</strong>
34+
<strong>解释:</strong>
3535
从 s[0] = 'a' 到 s[1] = 'A',不存在按键变更,因为不计入 caps lock 或 shift 。
3636
从 s[1] = 'A' 到 s[2] = 'b',按键变更。
3737
从 s[2] = 'b' 到 s[3] = 'B',不存在按键变更,因为不计入 caps lock 或 shift 。
@@ -75,7 +75,7 @@ tags:
7575
```python
7676
class Solution:
7777
def countKeyChanges(self, s: str) -> int:
78-
return sum(a.lower() != b.lower() for a, b in pairwise(s))
78+
return sum(a != b for a, b in pairwise(s.lower()))
7979
```
8080

8181
#### Java

solution/3000-3099/3019.Number of Changing Keys/README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ tags:
3030
<pre>
3131
<strong>Input:</strong> s = &quot;aAbBcC&quot;
3232
<strong>Output:</strong> 2
33-
<strong>Explanation:</strong>
33+
<strong>Explanation:</strong>
3434
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.
3535
From s[1] = &#39;A&#39; to s[2] = &#39;b&#39;, there is a change of key.
3636
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.
@@ -74,7 +74,7 @@ The time complexity is $O(n)$, where $n$ is the length of the string $s$. The sp
7474
```python
7575
class Solution:
7676
def countKeyChanges(self, s: str) -> int:
77-
return sum(a.lower() != b.lower() for a, b in pairwise(s))
77+
return sum(a != b for a, b in pairwise(s.lower()))
7878
```
7979

8080
#### Java
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class Solution:
22
def countKeyChanges(self, s: str) -> int:
3-
return sum(a.lower() != b.lower() for a, b in pairwise(s))
3+
return sum(a != b for a, b in pairwise(s.lower()))

0 commit comments

Comments
 (0)