Posted on

Description

Submission

class Solution {
public:
    bool checkRecord(string s) {
        int aCount = 0, lCount = 0;

        for(char ch: s) {
            if(ch == 'L') ++lCount;
            else lCount = 0;
            if(lCount >= 3) return false;
            if(ch == 'A') ++aCount;
        } 
        return aCount < 2;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *