Leetcode 551 Solution
This article provides solution to leetcode question 551 (student-attendance-record-i)
Access this page by simply typing in "lcs 551" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
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