字符串序列计数
func checkRecord(s string) bool {
absentCnt := 0
cLateCnt := 0
for i := 0; i < len(s); i++ {
v := s[i]
if uint8(v) == 'A' {
absentCnt ++
cLateCnt = 0
} else if uint8(v) == 'L' {
cLateCnt ++
} else {
cLateCnt = 0
}
if cLateCnt >= 3 {
return false
}
}
if absentCnt >= 2 {
return false
}
return true
}
标签:cLateCnt,return,出勤,551,++,absentCnt,leetcode
From: https://www.cnblogs.com/wudanyang/p/17014650.html