Problem statement

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

Solution

Just do what is asked: traverse string and check conditions.

Complexity

Time complexity is O(n), space complexity is O(1)

Code

class Solution:
    def checkRecord(self, s):
        return "LLL" not in s and sum([i=="A" for i in s]) <= 1