File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments