-
-
Notifications
You must be signed in to change notification settings - Fork 297
/
Copy path551.py
26 lines (26 loc) · 925 Bytes
/
551.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
__________________________________________________________________________________________________
sample 16 ms submission
class Solution:
def checkRecord(self, s: str) -> bool:
s=s.replace('LLL','XX')
return s.count('A')<=1 and s.count('XX') == 0
__________________________________________________________________________________________________
sample 13116 kb submission
class Solution:
def checkRecord(self, s: str) -> bool:
hasA = False
curL = 0
for c in s:
if c == 'A':
if hasA:
return False
hasA = True
curL = 0
elif c == 'L':
curL += 1
if curL > 2:
return False
else:
curL = 0
return True
__________________________________________________________________________________________________