class Solution {
public:
//查看是否有3个连续的L
bool check(string s)
{
for(int i=2;i<s.size();i++)
{
if(s[i-2]=='L'&&s[i-1]=='L'&&s[i]=='L')
{
return true;
}
}
return false;
}
int countA(string s)
{
int sum=0;
for(int i=0;i<s.size();i++)
{
if(s[i]=='A')
{
sum++;
}
}
return sum;
}
bool checkRecord(string s)
{
for(int i=0;i<s.size();i++)
{
if(countA(s)>1)
{
return false;
}
}
if(check(s))
{
return false;
}
return true;
}
};
LeetCode:551. 学生出勤记录 I
猜你喜欢
转载自blog.csdn.net/dosdiosas_/article/details/106222474
今日推荐
周排行