<p>You are given a string <code>s</code> representing an attendance record for a student where each character signifies whether the student was absent, late, or present on that day. The record only contains the following three characters:</p>

<ul>
	<li><code>&#39;A&#39;</code>: Absent.</li>
	<li><code>&#39;L&#39;</code>: Late.</li>
	<li><code>&#39;P&#39;</code>: Present.</li>
</ul>

<p>The student is eligible for an attendance award if they meet <strong>both</strong> of the following criteria:</p>

<ul>
	<li>The student was absent (<code>&#39;A&#39;</code>) for <strong>strictly</strong> fewer than 2 days <strong>total</strong>.</li>
	<li>The student was <strong>never</strong> late (<code>&#39;L&#39;</code>) for 3 or more <strong>consecutive</strong> days.</li>
</ul>

<p>Return <code>true</code><em> if the student is eligible for an attendance award, or </em><code>false</code><em> otherwise</em>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;PPALLP&quot;
<strong>Output:</strong> true
<strong>Explanation:</strong> The student has fewer than 2 absences and was never late 3 or more consecutive days.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;PPALLL&quot;
<strong>Output:</strong> false
<strong>Explanation:</strong> The student was late 3 consecutive days in the last 3 days, so is not eligible for the award.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s.length &lt;= 1000</code></li>
	<li><code>s[i]</code> is either <code>&#39;A&#39;</code>, <code>&#39;L&#39;</code>, or <code>&#39;P&#39;</code>.</li>
</ul>

class Solution {
public:
    bool checkRecord(string s) {
        int n = s.size();
        vector<vector<int>> dp(2, vector<int>(n, 0));
        if (s[0] == 'A')
            dp[0][0] = 1;
        if (s[0] == 'L')
            dp[1][0] = 1;
        for (int i = 1; i < n; i++) {
            if (s[i] == 'A') {
                dp[0][i] = 1 + max(dp[0][i], dp[0][i - 1]);
                if (dp[0][i] >=2)
                    return false;
            } else if (s[i] == 'L') {
                dp[0][i] = dp[0][i - 1];
                dp[1][i] = 1 + dp[1][i - 1];
                if (dp[1][i] >= 3)
                    return false;
            } else {
                dp[0][i] = dp[0][i - 1];
            }
        }
        return true;
    }
};
8300