551.学生出勤记录 I(简单)

给定一个字符串来代表一个学生的出勤记录,这个记录仅包含以下三个字符:

  1. 'A' : Absent,缺勤
  2. 'L' : Late,迟到
  3. '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% 的用户 

猜你喜欢

转载自blog.csdn.net/weixin_42234472/article/details/85037416
今日推荐