Leetcode 551 Solution

This article provides solution to leetcode question 551 (student-attendance-record-i)

https://leetcode.com/problems/student-attendance-record-i

Solution

class Solution:
    def checkRecord(self, s: str) -> bool:
        if len([ch for ch in s if ch == '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