【leetcode】学生出勤记录 I

 

bool checkRecord(char * s){
    int Acount = 0;
    int Lcount = 0;
    for (int i=0; i<strlen(s); i++)
    {        
        if (s[i] == 'A') 
        {
            Acount++;
            if (Acount > 1) return false;
        }
        else if (s[i] == 'L') 
        {
            Lcount++;
            if (Lcount >2) return false;
            continue;
        }
        Lcount = 0;
    }
    return true;
}

 

posted @ 2020-09-04 11:15  温暖了寂寞  阅读(154)  评论(0编辑  收藏  举报