> For the complete documentation index, see [llms.txt](https://timmybeeflin.gitbook.io/cracking-leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://timmybeeflin.gitbook.io/cracking-leetcode/string/551.-student-attendance-record-i.md).

# 551. Student Attendance Record I

T: O(n)

S: O(1)

```java
class Solution {
    public boolean checkRecord(String s) {        
        int aCount = 0;
        for (char c : s.toCharArray()) {
            if (c == 'A') {
                aCount++;
                if (aCount >= 2) {
                    return false;
                }
            }
        }
        return !s.contains("LLL");
    }
}

/*
The student was absent ('A') for strictly fewer than 2 days total.
The student was never late ('L') for 3 or more consecutive days.


A count < 2
L no 3 consecutive days

*/
```
