We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 34bae79 commit 2dc82d8Copy full SHA for 2dc82d8
0717. 1-bit and 2-bit Characters.py
@@ -0,0 +1,18 @@
1
+#Runtime: 44 ms, faster than 94.77% of Python3 online submissions for 1-bit and 2-bit Characters.
2
+#Memory Usage: 14.1 MB, less than 90.57% of Python3 online submissions for 1-bit and 2-bit Characters.
3
+
4
+class Solution:
5
+ def isOneBitCharacter(self, bits: List[int]) -> bool:
6
+ count_0 = 0
7
+ if bits.count(0) > 1:
8
+ for i in range(len(bits)):
9
+ if bits[~i] == 0:
10
+ count_0 += 1
11
+ if count_0 == 2:
12
+ if i % 2 == 1:
13
+ return True
14
+ else:
15
+ return False
16
+ if len(bits) % 2 == 1:
17
18
0 commit comments