给定一个字符串来代表一个学生的出勤记录,这个记录仅包含以下三个字符:
- 'A' : Absent,缺勤
- 'L' : Late,迟到
- 'P' : Present,到场
如果一个学生的出勤记录中不超过一个'A'(缺勤)并且不超过两个连续的'L'(迟到),那么这个学生会被奖赏。
class Solution:
def checkRecord(self, s):
"""
:type s: str
:rtype: bool
"""
if s.count('A')>1 or 'LLL' in s:
return False
return True (自己完成)
执行用时: 44 ms, 在Student Attendance Record I的Python3提交中击败了99.18% 的用户