Student Attendance Record I
Last updated
Last updated
class Solution(object):
def checkRecord(self, s):
"""
:type s: str
:rtype: bool
"""
return s.count('A') <=1 and 'LLL' not in sclass Solution(object):
def checkRecord(self, s):
"""
:type s: str
:rtype: bool
"""
#return s.count('A') <=1 and 'LLL' not in s
count = 0
maxcont = 0
for i in s:
if i == 'L':
count += 1
maxcont = max(maxcont, count)
else:
count = 0
if maxcont <= 2 and s.count('A') <= 1:
return True
return False