Skip to content

Practice Student Attendance Record I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#551
LeetCode Problem

Student Attendance Record I

Problem Statement

An attendance string uses A for absent, L for late and P for present. Return whether it qualifies for the attendance award: it must contain fewer than two A characters in total and must never contain three or more consecutive L characters.

Source: Student Attendance Record I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "PPALLP"
Output
true

# Example 2

Input
s = "PPALLL"
Output
false

Constraints

1 <= s.length <= 1000
s[i] is either 'A', 'L', or 'P'.

Related LeetCode Problems

Practice more problems similar to Student Attendance Record I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.