Student Attendance Record I

Problem Id: 551 Difficulty: Easy


Intuition

Solution


class Solution:
    def checkRecord(self, s: str) -> bool:
        if s.count('A') > 1:
            return False
        for i in range(len(s) - 2):
            if s[i] == 'L' and s[i + 1] == 'L' and s[i + 2] == 'L':
                return False
        return True