Skip to content

Commit f5f457d

Browse files
committed
update
1 parent ae6ed03 commit f5f457d

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

code/709.转换成小写字母.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# @lc app=leetcode.cn id=709 lang=python3
3+
#
4+
# [709] 转换成小写字母
5+
#
6+
7+
# @lc code=start
8+
class Solution:
9+
def toLowerCase(self, s: str) -> str:
10+
a = ord('a')
11+
A = ord('A')
12+
Z = ord('Z')
13+
res = ''
14+
for ss in s:
15+
if Z >= ord(ss) >= A:
16+
res += chr(a + ord(ss) - A)
17+
else:
18+
res += ss
19+
return res
20+
# @lc code=end
21+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# @lc app=leetcode.cn id=717 lang=python3
3+
#
4+
# [717] 1 比特与 2 比特字符
5+
#
6+
7+
# @lc code=start
8+
class Solution:
9+
def isOneBitCharacter(self, bits: List[int]) -> bool:
10+
i = 0
11+
res = False
12+
while i < len(bits):
13+
b = bits[i]
14+
if b == 1:
15+
i += 2
16+
res = False
17+
else:
18+
i += 1
19+
res = True
20+
return res
21+
# @lc code=end
22+

0 commit comments

Comments
 (0)